Question: Q3-Write a java program that has 2 methods averageSpeed and main method. .The average Speed computes and returns the average speed of a car, given

 Q3-Write a java program that has 2 methods averageSpeed and main

Q3-Write a java program that has 2 methods averageSpeed and main method. .The average Speed computes and returns the average speed of a car, given the distance traveled and the In the main method, promp the user to enter the distance travelled and the traveling time, then calls the time spend in the travel (in minutes). averageSpeed method and display the message "You have violated the driving rules" if the average speed exceeds 140 km/hour otherwise display the message "You are a good driver" Write a method Number of fines that takes as an input an arrays of 10 elements, each element represents the average speed recorded in the past 10 days. The method returns the number of fines that need to be issued (The number of fine is equivalent to the number of speed violations). You may need to create another method to populate an array with 10 recorded speed violations. (Bonus) Sample Inputs 1: Please enter the distance traveled in km: 150 Please enter the time spend in the travel: 60 You have violated the driving rules your speed was: 150 km/hour Please enter the distance traveled in k: 150 Please enter the time spend in the travel: 90 Sample Output 2: You are a good driver: your driving speed was: 100 Km/hour

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!