a program

Budget Range (EUR)
< 100 EUR
End of bidding period
Proposal Period Expired
Required skills
Web & Programming, C++
Buyer
ken***  - South Georgia And The South Sandwich Islands
Description

 

PROBLEM#: 1

A parking garage charges a R7.00 minimum fee to park for up to three hours. The   garage charges an additional R1.75 per hour or part thereof in excess of three hours. Assume that no car parks for longer than 24 hours at a time. To determine how long a car was parked, both the entry time and exit time are converted to minutes. The entrance time in minutes is then subtracted from the exit time in minutes, and these minutes are converted back to hours and minutes before the parking fee is calculated.

Write a program that calculates and prints the parking charges for customers who parked in this garage. Twenty customers use the parking garage at any given time. For each customer the program has to:

·        Input the time when the parking garage was entered

·        Input the time when it was exited

·        Convert both the entry and exit time  to minutes

·        Calculate how long the car was parked in minutes (parked time)

·        Convert the parked time in minutes back to time in hours and minutes

·        Calculate the charge (amount owed by the customer)

·        Display the receipt for the customer (display entry and exit times (in 24h00 format, duration for parked time and charge

·        Calculate the total of daily receipts

·        Finally the total amount of all the receipts should be displayed with informative messages

The program should consist of five functions. Declare constants for the number of minutes in an hour, the minimum fee (R7.00), the cut-off time of three hours, the hourly fee of R1.75 and the number of customers (20). Follow the conventions of the Study Guide and prescribed text when writing the program.

Main function()

      Declare the following variables:        

                  entranceHour, entranceMinutes

                  exitHour, exitMinutes

                  entranceTimeInMins, exitTimeInMins, minutesParked;

                  parkedHours, parkedMinutes;

                  charge, totalCharges;

Use a for loop going from 1 to the number of customers. The other four functions should be called inside the for loop

        Function InputAndValidate()

This function inputs the time. The time should be entered as two separate values for the hours and minutes e.g. the customer enters the parking garage at 9h30, the time should be entered as 9 for the hour and 30 for the minutes. Do not accept a value less than 0 or more than 24 for the hour, or a value of less than 0 or more than 59 for the minutes. If this happens a prompting message should be displayed and the values entered repeatedly until they are valid. If a value of 24 has been input for the hour, the minutes should be made 0, regardless of what value the user has entered for the minutes. You have to decide yourself on the type of function and the number of type(s) of the parameters

     Function convertToMinutes()

This function converts the time given in hours and minutes to time in minutes, e.g. 9h30 is converted to 570 minutes. You have to decide yourself on the type of function and the number and type(s) of the parameter(s)

    Function convertBackToTime()

This function converts the time given in minutes to time in hours and minutes, e.g. 570 minutes is converted to 9h30. You have to decide the type of function and the number and type(s) of parameter(s).

Hint: Use the operators / and % to calculate the number of hours and minutes from the total number of minutes

     Function calcCharge()

This function calculates the amount due based on the parked time in hours and minutes. Again you have to decide yourself on the type of function and the number of type(s) of the parameter(s)

Run your program on the data below. The first two values in a row represent the hours and minutes of the entry time and the last two values represent the hours and minutes of the exit time.

Submit the printouts of the program and output together with the USB

9 30             13 23

8 00             12 59

10 12           13 13

10 00           12 12

7 01             17 14

-5 65           10 60

6 18             16 33

14 15           16 04

13 11           17 45

11 27           24 55

8 55             25 61

8 55             15 47

Project Type Fixed
Privacy Appear on twago and search results outside twago (e.g. Google)
Implementation Aug 26, 2011 - Aug 28, 2011
Project competition Bid-details will be visible only to me
All Comments  9 persons following the discussion
Public questions & answers allow direct, quick and uncomplicated communication between customer and service-provider. Please use questions & answers section only to clarify open questions regarding the project requirements. Off-topic discussions will be removed by twago. Exchange of direct contact information as e-mail, telephone number or skype id are not allowed. Bids made in this section can not be considered as relevant and will also be deleted. Please use the "Place your bid" button below to make your offer.
about a minute ago
about a minute ago
{0} minute ago
{0} minutes ago
{0} hour ago
{0} hours ago
{0} day ago
{0} days ago
{0} week ago
{0} weeks ago
{0} month ago
{0} months ago
{0} year ago
{0} years ago
[obscured]
Verified User User Verification

You can show your business partners that your account information is real. Users with verified accounts significantly benefit from higher trust.
Medium Medium Member

The provider has signed up for a Medium Membership.Medium Members are usually more active and do more business with twago than Beginner members.
Premium Premium Member

The provider has signed up for a Premium Membership. Premium Members very active providers. Premium Members usually do a lot of business with twago.
Freelancer Freelancer Member

The provider has signed up for a Freelancer Membership. Freelancer Members are usually more active and do more business with twago than Beginner or Medium members.
Premium Premium Member

The provider has signed up for a Premium Membership. Premium Members are very active providers. Premium Members usually do a lot of business with twago. Premium and VIP Providers can be contacted directly.
VIP VIP Member

The provider has signed up for a VIP Membership. VIP Members are twagos most active providers. VIP Providers do a lot of business with twago. Premium and VIP Providers can be contacted directly.
Verified Reference Reference Verification

twago gives you the opportunity to show your customers that your references are real. Providers with verified references have significantly higher chances of getting awarded for a project.
twago user
9 months ago
Is C++ mandatory ?
Offers and Providers

The bids are only visible for registered users. Please register or login to see all details.

Sign in to twago and start to work on projects today.
Sign in to twago today. Once registered you will have access to projects online and via email.
Ready to post your project?
Post your project on twago and find experts you need.
Revision:5553

ABOUT SSL CERTIFICATES
SagePAY
Diversity