subject

CODE IN PYTHON: Your task is to write a simple program that would allow a user to compute the cost of a road trip with a car. User will enter the total distance to be traveled in miles along with the miles per gallon (MPG) information of the car he drives and the per gallon cost of gas. Using these 3 pieces of information you can compute the gas cost of the trip.

User will also enter the number of days it will take to complete the trip. For each night (day-1 nights), user will need a hotel. We will ask for the number of stars for the hotel the user wants to stay. 5 star hotel costs $250 per night. 4 star hotel costs $180 per night. 3 star hotel costs $120 per night, 2 star hotel costs $100 per night and finally 1 star hotel costs $50 per night. Using the hotel costs and the number of nights users will need to stay at a hotel, you can compute the hotel cost of the trip.

Please note that 5 star and 4 star hotels give 10% discount if the user will be staying more than 2 nights -- (these are chain hotels, so even if you are staying at different locations discount apply).

We should also account for the cost of meals. This depends on the type of hotel the user is staying. In general, we take 20% of hotel cost as the meal cost (after 10% hotel discount if applicable).

Example Run #1

Distance: 350

MPG : 15

Gas Price: 3.79

Days Traveling : 3

Hotel Stars (1-5) : 3

Your total cost is $376.43333333333334

Example Run #2

Distance: 400

MPG : 20

Gas Price: 2.99

Days Traveling: 1

Hotel Stars (1-5): 5

Your total cost is $59.800000000000004.

Example Run #3

Distance: 150 MPG : 25 Gas Price: 1.99 Days Traveling : 2 Hotel Stars (1-5): 5 Your total cost is $311.94.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 19:30
Which of the following are types of formatting you can apply to a spreadsheet? choose all that apply.
Answers: 3
question
Computers and Technology, 22.06.2019 10:00
You need a reliable network for about twenty-five computers that will be distributed across a large building. it is important that the network be relatively cheap. which topology should you use?
Answers: 1
question
Computers and Technology, 22.06.2019 12:30
Some of the first computer games were created in the early 1970s by college students experimenting after hours to see what the were capable of doing.
Answers: 3
question
Computers and Technology, 22.06.2019 23:30
To check spelling errors in a document, the word application uses the to determine appropriate spelling. internet built-in dictionary user-defined words other text in the document
Answers: 1
You know the right answer?
CODE IN PYTHON: Your task is to write a simple program that would allow a user to compute the cost...
Questions
question
Social Studies, 12.01.2020 03:31
Questions on the website: 13722362