Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The aim of this exercise is to write a program that calculates bicycle rental amounts (for an online 24/24 service) Download the file rental bikes.cpp

image text in transcribed

The aim of this exercise is to write a program that calculates bicycle rental amounts (for an online 24/24 service) Download the file rental bikes.cpp and complete it according to the below instructions. The rental rates are as follows: - From 00:00 to 07:00 and from 17:00 to 24:00: 1 dollars.hour. - From 07:00 to 17:00: 2 dollars hour. The program will ask the user to enter the start and end hours of the rental as integers (part of the furnished code) and will compute and display the rental cost. You will adopt the following simplifications: . the hours are integers (we don't mind about minutes, each started hour will be fully paid): the start time (i.e. hour) of the rental period must always be less than the end time (ie. hour) of the rent. This means that one cannot hire a bicycle more than 24 hours and that cach rental period must lie within the same day. If the inputs are correct, then the program will calculate and show the rental amount on the screen strictly following the format presented in the examples below. If the times entered by the user are not between 0 and 24 (inclusive), then an error message strictly respecting the following format will be shown and the program will terminate: The hours entered must be benveen 0 and 24! If the start time of the rent is equal to the end time, then an error message strictly respecting the following format will be shown and the program will terminate: Very strange, it seems you don't want to rent a bike! If the end time of the rent is less than the start time, then an error message strictly respecting the following format will be shown and the program will terminate: The end of the rental period cannot be before its start! The provided file already contains some instructions that must be used to produce the requested output. Example of a run of the program: Enter the start of the location as an integer): 6 Enter the end of the location (as an integer) : 9 You rented the bike for 3 hour(s) The number of hours you rented the bike between 7:00 and 17:00 19:2 The total amount to pay is 5 dollar(s). Press any key to continue

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_2

Step: 3

blur-text-image_3

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

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

6. Conclude with the same strength as in the introduction

Answered: 1 week ago

Question

7. Prepare an effective outline

Answered: 1 week ago