0

Speedy, Still Not, Gonzales by CodeChum

Java Programming Language Recall that the general speed limits in the Philippines in 60 km/h on most highways and 100 km/h on expressways. Let's add a minimum speed when one is in an expressway and that minimum speed limit is 40 km/h. Your goal here is to compute the speed of automobiles based on distance travelled and time taken to cover this distance. And at the same time, whether the driver is over-speeding, within speed limit, or under-speeding. Input Format The input is composed of 3 positive integers representing the road the driver is on (1 for highway, 2 for expressway), distance traveled in meters, and the number of minutes it took to cover the given distance. Input Sample 1�2500�356 Output Format The output should contain the computer speed in km/h (two decimal places) and the status as to whether the driver is over-speeding, within-speed-limit, or under-speeding. Output Sample 0.42穡ithin-speed-limit

23rd Nov 2020, 2:34 AM
Liason Ngayan
Liason Ngayan - avatar
5 Respuestas
+ 6
___ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); double road = input.nextDouble(); double meters = input.nextDouble(); double minutes = input.nextDouble(); double hour = minutes/ 60; double km = meters/ 1000; double Kph = km/hour; if(road == 1 && Kph <= 60) { System.out.format("%.2f", Kph); System.out.print(" within-speed-limit"); } else if(road==1 && Kph >60) { System.out.format("%.2f", Kph); System.out.print(" over-speeding"); } else if(road == 2 && Kph > 100) { System.out.format("%.2f", Kph); System.out.print(" over-speeding"); }
23rd Nov 2020, 2:39 AM
Liason Ngayan
Liason Ngayan - avatar
0
That's code but it appears error
23rd Nov 2020, 2:35 AM
Liason Ngayan
Liason Ngayan - avatar
0
I tried a lot, but still error.
23rd Nov 2020, 2:39 AM
Liason Ngayan
Liason Ngayan - avatar
0
Thanks 👍
17th Mar 2021, 2:37 PM
Liason Ngayan
Liason Ngayan - avatar