Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8788843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:14:18+00:00 2026-06-13T22:14:18+00:00

I have been given the following assignment: Write a function (documentation included) that given

  • 0

I have been given the following assignment:

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.

Assumptions:

  1. no overnight parking
  2. there is no charge for part of an hour
  3. the time is given in military style (1:20p.m. is 1320)

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.

This is the 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",&entry , &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

I cannot build it and I am facing problems with it. For example, I get the following error:

Undefined symbols for architecture x86_64: “calcRate(int, int)”, referenced from: _main in Parking.o (maybe you meant: calcRate(int, int, double)

I’m stuck for almost 2 hours now.
Any kind souls out there?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:14:19+00:00Added an answer on June 13, 2026 at 10:14 pm

    Difference between function declaration and definition

    Function Declarations

    int calcRate (int entry , int exit);
    

    Definition header

    double calcRate (int entry,int exit,double cost)
    

    So either change Declaration or definition header

    for Eg:
    Change definition header to

    int calcRate(int entry,int exit)
    

    and add declare

    double cost
    

    within function calcRate.

    Instead of

      printf("Please Enter Entry and Exit time(In military style. For example : 9.30am as 0930)\n");
      scanf("%d %d\n",&entry , &exit);
    

    Do

     printf("Please Enter Entry (In military style. For example : 9.30am as 0930)\n");
     scanf("%d",&entry);
     printf("\n Please exit Entry (In military style. For example : 9.30am as 0930)\n");  
     scanf("%d",&exit);        
    

    No “\n” within scan.

    EDIT:

    In case of overnightparking

    Instead of

    hours = (exit-entry)/100;
    

    use

    if(exit>entry)
        hours = (exit-entry)/100;
    else
        {
            int overnightHours;
            overnightHours = (entry-exit)/100;
            hours=2400-overnightHours;
        }
    

    This will remove negative value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been given the following code that should perform an ssl handshake and
Good day, I have been given an assignment that gets data off a CSV
I have been given an assignment to complete the following task: I will be
I have been given the following request. Please give 7% of the current contacts
I have been given the following: <div class=elf>Label 1</div> <div class=eff>Data 1</div> <div class=elf>Label
I have a requirement. I have been given the following table DownLineid UplineId Name
I have been given some vendor supplied driver code written in C that runs
I have been given an assignment to drop one of our product's dll and
I have been given the following bit of code as an example: Make port
I have been given a header with the following declaration: //The index of 1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.