Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 5: Write a complete program in Java, including javadoc comments (worth pts) to do the following: 1. Read in the id number of a

image text in transcribed
Question 5: Write a complete program in Java, including javadoc comments (worth pts) to do the following: 1. Read in the id number of a trip offered by a travel company, the number of miles traveled, and the cost of each mile. Include prompts. Print the original data right after you read it in. A typical set of values could be: 1234 15 22.67 This means trip 1234 is 15 miles, at a cost per mile of 22.67 2. Compute the base price for the trip. This is simply the number of miles times the cost of each mile. Print the base price. 3. The travel company gives a discount of 7.5% if the number of miles is 20 or more. For each trip, determine if the trip gets the discount. Print an appropriate message in each case (whether or not the trip gets the discount). 4. Determine the trip's final price. If the trip gets the discount, the final price is the base price for the trip minus the discount. If the trip does not get the discount, the final price is the base price. Print the final price and the discount. You should print 0 for the discount if there is no discount on this trip 5. Repeat the entire series of calculations for the next trip, and the next, until all of the trips have been processed. You must decide how to tell when all of the trips have been processed. Make sure that this method is described in a comment 6. At the end, print the total number of trips. Also, print how many of the trips did not receive the discount Hint: You will need two separate counters

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

=+ How well do you think you could do your job?

Answered: 1 week ago