Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please complete in java only. And provide comments to explain what is done. Also please name variables with easy to understand descriptive names. PROBLEM: In
Please complete in java only. And provide comments to explain what is done. Also please name variables with easy to understand descriptive names.
PROBLEM: In taking a vacation trip, MapQuest and Google Maps provide very valuable information. Newer versions of these on-line tools provide not only the distance traveled, but also how long it will take you and how much it will cost for gasoline. In this program, you will be traveling a sequential route through ACSLland with all destinations given in alphabetical order. Each time that you input two cities, the kind of vehicle you are driving, the kind of highway it is, and the cost per gallon of gasoline, print out the total distance between these two inputted cities, the total time it should take you, and the total cost of gasoline. Assume that the following information between each pair of adjacent cities on your route is given below A to B-450 miles B to C-140 miles to D 120 miles D to E-320 miles E to F-250 miles to G -80 miles For example, if you are driving a mid-size vehicle and driving on the highway from city A to city C with a cost of S3.79/gallon, output 590 miles, "09:50" hours and minutes, and $89.44 for gas. Given the following kinds of cars and types of roads, Compact(C) 28 m/gal Mid-size(M): 25 m/gal Full-size(F) 22 m/gal roads(M): 55 miles/hour Van/SUV(V): 20 m/gal roads(S): 45 miles/hour InterstateI): 65 miles/hour Highway(H): 60 miles/hour Main Side INPUT: There will be 5 lines of input. Each line will contain four letters for the starting city, the ending city, the kind of vehicle, and the type of road followed by the average cost for a gallon of gasoline. OUTPUT: For each input line, print the total distance traveled, the total hours and minutes in "hh:mm" format with two 2-digit whole numbers and a colon between them, and the total cost for gas in 5xxx.xx" format with a dollar sign and exactly two decimal places. All numbers are rounded to fit the formats stated. In Sample #3 32.7 becomes 33. SAMPLE INPUT OUTPUT SAMPLE I, A, C, M, H, 3.79 $89.44 2. E, F, C, S, 3.69 $32.95 3. B, E, F, M, 3.59 94.65 4, F, G, V, H, 3.89 $15.56 5. A, G, C, I, 3.63 $176.31 1. 590, 09:50 2. 250, 05:33, 3. 580, 10:33, 4. 80, 01:20 5. 1360, 20:55, ACSL American Computer Science League Navigating ACSLland Intermediate Division TEST INPUT TEST OUTPUT . A, C, M, I, 3.59 $84.72 2. D, E, C, S, 3.69 $42.17 3. C, E, F, I, 3.79 $75.80 4, B, G, V, H, 3.72 $169.26 5. A, F, V, M, 3.54 1. 590, 09:05, 2. 320, 07:07 3. 440, 06:46, 4. 910, 15:10 5. 1280, 23:16, $226.56 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started