Menu
support@nursinghomework.org
+1 714-215-3097

(Solved) : Write Java Program Called Speed Following 1 Uses Loop Repeats 3 Times Within Loop Prompt U Q35539132

Write a Java program called Speed which does the following: 1. Uses a for loop which repeats 3 times. Within the loop, promptWrite a Java program called Speed which does the following: 1. Uses a for loop which repeats 3 times. Within the loop, prompt the user to enter a distance in miles and store the distance in a double array called distance a. b. prompt the user to enter time in hours and store the hours in a double array called hours 2. Calls the method calculateSpeed with the following header public static void calculateSpeed (double[] distance, double[] time) to calculate and display the speed for each distance and time (Hint:speed distance/time). For completion, make sure that you include the units as shown in the sample output. User input is highlighted in yellow. Sample output: Enter distance in miles: 180 Enter time in hours: 3 Enter distance in miles: 16 Enter time in hours: 0.75 Enter distance in miles: 268 Enter time in hours: 4.5 The speed for distance = 180.00 miles and time . 3.00 hours is: 60.00 miles/hours The speed for distance16.00 miles and time 0.75 hours is: 21.33 miles/hours The speed for distance-268.00 miles and time 4.50 hours is: 59.56 miles/hours Show transcribed image text Write a Java program called Speed which does the following: 1. Uses a for loop which repeats 3 times. Within the loop, prompt the user to enter a distance in miles and store the distance in a double array called distance a. b. prompt the user to enter time in hours and store the hours in a double array called hours 2. Calls the method calculateSpeed with the following header public static void calculateSpeed (double[] distance, double[] time) to calculate and display the speed for each distance and time (Hint:speed distance/time). For completion, make sure that you include the units as shown in the sample output. User input is highlighted in yellow. Sample output: Enter distance in miles: 180 Enter time in hours: 3 Enter distance in miles: 16 Enter time in hours: 0.75 Enter distance in miles: 268 Enter time in hours: 4.5 The speed for distance = 180.00 miles and time . 3.00 hours is: 60.00 miles/hours The speed for distance16.00 miles and time 0.75 hours is: 21.33 miles/hours The speed for distance-268.00 miles and time 4.50 hours is: 59.56 miles/hours

Leave a Reply

Your email address will not be published. Required fields are marked *