Computers and Technology

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.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 12:00, clevelandjaniya1
Which of these is a benefit of using objects in a powerpoint presentation? a. collaborators can create the external files while you create and edit the slide show. b. you can easily change the theme and design of the presentation. c. you can have older data in the source file while having up-to-date data in the presentation. d. collaborators can easily share the presentation.
Answers: 2
image
Computers and Technology, 23.06.2019 15:20, yeahmaneee
What does a bonus object do? a. subtracts lives b. keeps track of a player's health c. gives a player an advantage d. makes text appear
Answers: 1
image
Computers and Technology, 23.06.2019 20:50, terryhgivens5349
3.11.3 quiz: comparing and analyzing function typesquestion 4 of 102 pointswhat can you say about the y-values of the two functions f(x) = 3x2-3 andg(x)=2* - 3?
Answers: 2
image
Computers and Technology, 24.06.2019 18:30, trevorhenyan51
Dereck works for long hours on his computer.  he frequently experiences physical strain by the end of the day because he does not follow an important rule of ergonomics with respect to the use of keyboards.  which of the following actions of dereck could lead to physical strain? a.  placing the keyboard exactly in front of him while typingb.  keeping hands and wrists straight while typingc.  using wrist pads throughout the dayd.  pounding at the keys on the keyboard while typinge.  resting his hands on the keyboard when he is not typing
Answers: 1
Do you know the correct answer?
CODE IN PYTHON: Your task is to write a simple program that would allow a user to compute the cost...

Questions in other subjects: