Like Tree1Likes
  • 1 Post By laserlight

parking garage program please help anyone please

This is a discussion on parking garage program please help anyone please within the C++ Programming forums, part of the General Programming Boards category; PROBLEM#: 1 A parking garage charges a R7.00 minimum fee to park for up to three hours. The garage charges ...

  1. #1
    Registered User
    Join Date
    Aug 2011
    Location
    giyani
    Posts
    1

    parking garage program please help anyone please

    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

  2. #2
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    OMG
    We're out of C++ code.
    Please bring your own or look elsewhere.
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,401
    Read the homework policy.

    I shall close this thread now. You can post a new thread that asks a more specific question after you have actually tried to do your homework.
    AndrewHunter likes this.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. calculating garage charges
    By nynicue in forum C Programming
    Replies: 7
    Last Post: 02-22-2009, 05:18 PM
  2. parking garage calculator help
    By vgame64 in forum C++ Programming
    Replies: 4
    Last Post: 02-15-2006, 03:54 PM
  3. garage simulation
    By rayrayj52 in forum C++ Programming
    Replies: 14
    Last Post: 11-03-2004, 02:49 PM
  4. hosting vs parking?
    By afreedboy in forum Tech Board
    Replies: 5
    Last Post: 09-28-2004, 06:17 AM
  5. Newbie Parking
    By Gamemonkey in forum Linux Programming
    Replies: 4
    Last Post: 12-29-2003, 04:23 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21