Note that there are some explanatory texts on larger screens.

plurals
  1. POCoding a simple parking fee calculator using only C functions
    primarykey
    data
    text
    <p>I have been given the following assignment: </p> <blockquote> <p>Write a function (documentation included) that given the entry and the exit time of a vehicle in a parking lot, and the hourly rate, calculates the amount due.</p> <p>Assumptions:</p> <ol> <li>no overnight parking</li> <li>there is no charge for part of an hour</li> <li>the time is given in military style (1:20p.m. is 1320)</li> </ol> <p>You also have to write a test-driver for your function: in main() declare and initialize as many variables as needed, then call the function and display the amount.</p> </blockquote> <p>This is the code:</p> <pre><code>int calcRate (int entry , int exit); int main (void) { // Local Declarations int entry; int exit; //Statements printf("Please Enter Entry and Exit time(In military style. For example : 9.30am as 0930)\n"); scanf("%d %d\n",&amp;entry , &amp;exit); double fee = calcRate(entry,exit); printf("Your Parking Fees are %f\n", fee); return 0; } //main /*==============calcRate================ This function calculates the cost of parking */ double calcRate (int entry,int exit,double cost) { int hours; double rate = 2.00; //Statements hours = (exit-entry)/100; cost = hours * rate; return (cost); } //calcRate </code></pre> <p>I cannot build it and I am facing problems with it. For example, I get the following error:</p> <blockquote> <p>Undefined symbols for architecture x86_64: "calcRate(int, int)", referenced from: _main in Parking.o (maybe you meant: calcRate(int, int, double)</p> </blockquote> <p>I'm stuck for almost 2 hours now. Any kind souls out there?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload