Question: module projectWork2 { import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner (System.in); System.out.println(Enter number of

module projectWork2 { import java.util.*;

public class Main {

public static void main (String[] args) {

Scanner sc = new Scanner (System.in); System.out.println("Enter number of runners : "); //asking user to input number of runners int runners=sc.nextInt(); for(int k=0;k {

// asking user to input the number of runs

System.out.print("Enter how many runs you want to run : ");

int noOfRuns =sc.nextInt(); // taking the user input //ask user to Enter name of the runner sc.nextLine(); System.out.println("Enter name of the runner"); String name=sc.nextLine();

// now iterating upto that numbers

for(int i=0;i

double time,distance,averagePace; //variables to store the time and distance

// taking distance and time for each run

System.out.print(" Enter the distance in miles : ");

distance = Double.parseDouble (sc.nextLine());

System.out.print ("Enter the time taken to travel the distance : ");

time = Double.parseDouble (sc.nextLine());

// now displaying the average for each run //display name System.out.println("Name : "+name);

averagePace = time/distance; System.out.println("Average pace of Run-"+(i+1)+" is : "+averagePace+"(minutes per mile)"); }

System.out.println("Total number of runners : "+runners+" Total number of runs :"+noOfRuns); }

System.out.println(" Thank you for using my running Log Program");

}

}

Using the code above do the following assignment for my java programming ll class:

Project: Running log

This Semesters Project will be on Creating A Running Log. The running log can consist of recording/calculating running pace for certain distances over time. It is also possible the project will grow and incorporate other aspects of running- For example, recording the outdoor temperature during a run, calculating how many calories were burned during a run, cumulative running distance, etc.

This weeks project work is exactly the same as the previous project assignment (arrays), but in this case you are to create a Run class, and Runner class that will be used.

The Run class should have:

-public double variable called DistanceMiles

-public double variable called Minutes

-public method called GetPace() which returns a double value, corresponding to the pace of each runner (in minutes per mile)

The Runner class should have:

-public string variable called Name

-private array variable of Run objects called runs

-public void method called AddRun which takes a Run object as an input parameter, and adds to the runs private array variable.

-public method called GetAveragePace() which returns a double value, corresponding to the average of all GetPace() method calls for each Run object in the runs private array variable.

  1. Ask the user for number of runners
    1. Hint: With this, create an array of Runner objects of this size
  2. For each runner: (Hint: Create a Runner object for each runner)
    1. Ask the user the name of the runner
      1. Hint: With this, assign the Name variable for the Runner object
    2. Ask the user for number of runs
    3. For each run, ask the user (Hint: Create a Run object for each run)
      1. What the distance was in miles (in decimal format, e.g. 3.1 miles is acceptable)
        1. Hint: With this, assign the DistanceMiles variable for the Run object
      2. What the time was in minutes (in decimal format, e.g. 23.9 minutes is acceptable)
        1. Hint: With this, assign the Minutes variable object
      3. Hint: use the AddRun method for the current Runner Object, to add this run to the current Runner objects runs array.
  3. After gathering all the info from steps 1 & 2 above, output a summary in 3 sections:
    1. The name of each runner along with the average pace of each runner
      1. Hint: Loop through the array of Runner objects and print the Name variable for each runner.
    2. The average pace of all runs for all runners
      1. Hint: Loop through the array of Runner objects, and average all values of the GetAveragePace() method (average of averages), and print that.
    3. The total number of runners & runs
      1. Hint: Print the length of the array of Runner objects, and compute the total, going through each runner, the array lengths of Run objects.

For my Java Programming ll class please answer accordingly thank you, output and input can be anything you want it to be doesnt matter make something up!

Input and output again are up to you make it practical!

In general, Project work will be more free-form than other assignments. So in this case, your input/output format is more up to you. Please make it as usable and readable to the user as possible.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!