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 8693915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:39:19+00:00 2026-06-13T00:39:19+00:00

Hi, I’m very new to programming, for this program i am supposed to be

  • 0

Hi, I’m very new to programming, for this program i am supposed to be able to calculate someone’s monthly charges by using functions. When I compile it it’s fine, but when I try to debug it says I’ve failed so I can’t tell what I’m doing wrong. Here is my code:

//this program calculates a user’s monthly charges

#include <iostream>
#include <iomanip>

using namespace std;

//function prototypes
void showpackage();
void calculatePkg_A (int,int,int);
void calculatePkg_B (int,int,int);
void calculatePkg_C (int,int,int);


int main ()
{
    int inputPackage; //package choice
    double inputHours; //number of hours


    //constants for package choice
    const int pkg_A = '1' ,
               pkg_B = '2',
               pkg_C = '3';
     const char quit_choice = 'Q' || 'q';
    //constants for cost of package
    const int cost_A = 15,
              cost_B = 20,
              cost_C = 25;
    //constants for package access time
    const int hours_A = 50,
              hours_B = 100,
              hours_C = 150;
    cout << fixed << showpoint << setprecision (2);
    do
    { //display package options. 
        showpackage();
        cin >> inputPackage;

        //validate package selection
        while (inputPackage < pkg_A || inputPackage > pkg_C || inputPackage != quit_choice )
        {
            cout << "Please enter a valid package choice:";
            cin >> inputPackage;
        }
        //If user does not want to quit, proceed.
if (inputHours < 0 || inputHours > 720 || inputPackage != quit_choice)
        {
            //get the number of hours used
            cout << "How many hours were used?";
            cin >> inputHours;

                //display the total charges
                switch (inputPackage)
                {
                case pkg_A:
                    calculatePkg_A (cost_A, hours_A, inputHours);
                    break;
                case pkg_B:
                    calculatePkg_B (cost_B, hours_B, inputHours);
                    break;
                case pkg_C:
                    calculatePkg_C (cost_C, hours_C, inputHours);
                    break;
                }
            }
    } while (inputPackage != quit_choice);


            return 0;
}


//definition of function showPackage which displays package options

void showPackage()
{cout <<"An Internet service provider has three different packages for its customers: \n"
<<"1.Package A: For $15 per month with 50 Hours of access provided, additional hours \n"
<<"are $2.00 per hour over 50 hours.\n"
<<"2.Package B: For $20 per month with 100 Hours of access provided, additional hours \n"
<<"are $1.50 per hour over 100 hours.\n"
<<"3.Package C: For $25 per month with 150 Hours of access provided, additional hours \n"
<<"are $1.00 per hour over 150 hours.\n"
<<"Enter your choice either 1,2, or 3:";
}

//defintion of function calculatePkg_A. Displays total charges.


void calculatePkg_A (int cost_A, int hours_A, int inputHours)
    {
        cout << "The total charges are $"
             << (cost_A += (inputHours - hours_A) * 2) << endl;
}

//
//defintion of function calculatePkg_B. Displays total charges.
//

void calculatePkg_B (int cost_B, int hours_B, int inputHours)
    {
        cout << "The total charges are $"
             << (cost_B += (inputHours - hours_B) * 1.5) << endl;
}

//defintion of function calculatePkg_C. Displays total charges.


void calculatePkg_C (int cost_C, int hours_C, int inputHours)
    {
        cout << "The total charges are $"
             << (cost_C += (inputHours - hours_C)) << endl;
}

But whenever i try to debug it I keep getting the error message:

1>Program5.obj : error LNK2019: unresolved external symbol "void __cdecl calculatePkg_C(double,double,double)" (?calculatePkg_C@@YAXNNN@Z) referenced in function _main
1>Program5.obj : error LNK2019: unresolved external symbol "void __cdecl showpackage(void)" (?showpackage@@YAXXZ) referenced in function _main
    1>C:\Users\charlotte\Desktop\program5\Debug\program5.exe : fatal error LNK1120: 2 unresolved externals 
  • 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-13T00:39:21+00:00Added an answer on June 13, 2026 at 12:39 am

    First error is that the compiler decided you need to pass double types to calculatePkg_C. It expects:

    calculatePkg_C(double,double,double)
    

    But yours is:

    calculatePkg_C(int,int,int)
    

    You need to ask yourself why this would be. You’ve declared it at the top, and defined it below correctly. Is there something you are not showing? I notice you are passing inputHours which is a double. Try casting that as an int.

    The other error is showPackage. Your declaration (and usage) has the wrong capitalisation.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.