can any body help me out wid this ........as i m doing C not C++.....plz tell me the whole program........plzzzzzzzzz

Construct a solution algorithm and write a C program for the following programming problem. Use a top-down modular design. State clearly tasks that are to be performed by each module. Implement modules as C functions.
Your report should contain:

  • a flowchart of a complete program (using modules' notation)
  • flowcharts of all modules
  • a pseudocode algorithm of the mainline and all modules,
  • a desk check of the algorithm.
  • a source code of the C program
  • screen dumps of the output.

A parking garage charges a $2.00 minimum fee to park for up to three hours.
The garage charges an additional $1.50 per hour for each hour in excess of three hours. (There are no fractions of an hour. Any part of an hour is charged as a whole hour.) The maximum charge for any 24-hour period is $10.00.

Design an algorithm and write a program that will

· Read from the keyboard the registration numbers of cars (as 4 digits integer numbers), which have used the garage during one day of operation, and the number of hours each has been parked as hours and minutes. Use a sentinel value to finish the data entry.

· Calculate the fee for each car.

· Print the day's report. The report will include car registration numbers, the number of hours and the fee paid for each car, and the TOTAL fee received by the garage for the day.

The output should look as follows:

Registration No.

Time
Fee ($)

2398
5 h, 0 min
5.00
5547
3 h, 20 min
3.50
8865
7 h, 10 min
9.50
3320
4 h, 45 min
5.00

Total
23.00


The program should be designed for 3 sections (for the menu):
i) Car arrival
ii) Car departure, including calculation of the fee and storage of the data
iii) Display of daily data including total taken

You should use the “time_t” function for calculating in and out times and duration, and “FILE” for storage of Data.

Recommended Answers

All 5 Replies

Confused612, it would be fun to help you in your code. However you need to post what you have done so far in your assigment.
See here is a cool page that will help you in that regard.

And just so you know, it is frowned upon making double posting.

@aia
i have done a program whc gives the charges of a car i mean it asks the number of hours and gives the total chrges

this is wht i have done but i have a problem in this also tht when i right 3.5 hours it gives $2 charges and same in the case of 3 hours y?

#include <stdio.h>
#include<stdlib.h>
int main()
{
 int num_hours ,customers;
 float charge_min = 2.0,rate = 1.5 , charge_max = 10.;
 float calculate_charge;
  printf("enter the number of hours\n");
  scanf("%d",&num_hours);
  if(num_hours<=3)
  {
                         calculate_charge = charge_min;
                         }
        if ((num_hours>3) && (num_hours<24))
                         {
                              calculate_charge = charge_min +(num_hours-3)*rate;
                              }
         if(num_hours==24)
         {
                          calculate_charge = 10;
                          }
                              
 printf("charge = %f\n",calculate_charge);
     system("pause");
 return 0;
}

@aia
i have done a program whc gives the charges of a car i mean it asks the number of hours and gives the total chrges

If this program is part of the assigment or you are trying to make it part of the program that you want to create, just post the code using the proper tagging like it says here, and then ask question about what you don't understand how to make to work.

this is wht i have done but i have a problem in this also tht when i right 3.5 hours it gives $2 charges and same in the case of 3 hours y?

Sorry about that follow up post, you were faster than me posting back, and I didn't refresh the page.

Without looking at your code I can tell you about your question.
When you enter 3.5 that's a decimal that should be store in a float variable. You are storing it in a int variable which will demoted it to the next low whole number. Whether your enter 3.5 or 3 is the same if you assign it to a integer variable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.