Business HW problem C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • audiokarate
    New Member
    • Sep 2007
    • 16

    Business HW problem C++

    Hey everyone. I have this homework problem for my IS class and I am having trouble finding the variables and the next step after that. Can someone please help me out? This is the problem.

    Write a program to compute telephone bills for the local telephone company. Each customer has a base charge of $12.95 per month and gets charged extra for each local call and each long-distance call. The program should prompt the user for the number of local calls made during the month. The charge for each local call is $0.10. Use the += operator to add the cost of the local calls to the total bill. Then the program should prompt the user for the total charge for long-distance calls made during the month. Use the += operator to add the long-distance charges to the total bill. Finally, the program should calculate the tax on the total bill. The Tax rate is 8.72%. Use the *= operator to add the tax to the total bill by multiplying the total bill by 1.0872.

    and there it is. Any help would be greatly appreciated.
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    Which parts exactly are you having trouble with?

    Comment

    • audiokarate
      New Member
      • Sep 2007
      • 16

      #3
      finding the variables..I already know the constants

      Comment

      • audiokarate
        New Member
        • Sep 2007
        • 16

        #4
        This is what I have so far and I'm not sure if it's correct either.
        [code=cpp]
        #include <iostream>
        #include <iomanip>
        using namespace std;

        void main ()
        {

        Const double BASE_CHARGE_PER _MONTH = 12.95;
        Const double RATE_LOCAL_CALL S = 0.10;
        Const double TAX_RATE = 8.72;
        [/code]
        and thats it?

        Comment

        • Studlyami
          Recognized Expert Contributor
          • Sep 2007
          • 464

          #5
          You will need one variable which will hold the total cost for the monthly bill.

          You will need a variable for the user input. (i.e. 20 calls).
          other than that you have the variables that you need.

          Comment

          • audiokarate
            New Member
            • Sep 2007
            • 16

            #6
            Alright so this is what I have so far. Now all I have to do is to output a customer report for example:

            Base charge: $12.95
            Local call charge: (value will be based on user’s input)
            Long distance charge: (value will be based on user’s input)
            Total Bill: (value will be based on user’s input)

            This has got to show at the bottom after the bill is calculated and I am having trouble with it. I just need to get pointed in the right direction. How do I find the local call charge and input it where the parenthesis are?


            [code=cpp]
            //Assignment_1.cp p
            //ER
            //Program Purpose: Create a program that will compute telephone
            //bills for the local telephone company

            #include <iostream>
            #include <iomanip>
            using namespace std;

            int main()
            {

            const double LOCAL_RATE = 0.10; //RATE OF LOCAL CALLS
            const double LONG_D_RATE = 0.15; //RATE OF LONG D CALLS
            const double TAX_RATE = 8.72; //FIXED TAX RATE

            double base = 12.95; //Base charger per month
            double local_calls = 0;
            double long_distance = 0;
            double total = 0;

            cout << setprecision(2)
            << setiosflags(ios ::fixed)
            << setiosflags(ios ::showpoint);


            cout << "***Bayside Telephone Company*** "<< endl << endl;
            cout << endl;

            cout << "Enter number of local calls made during the month : ";
            cin >> local_calls;
            cout << endl;
            cout << "Enter number of long distance calls made during the month : ";
            cin >> long_distance;
            cout << endl;


            base += local_calls * LOCAL_RATE;
            base += long_distance * LONG_D_RATE;
            base *= 1.0872;

            cout << "The total bill for this month is : $" << base;
            cout << endl;

            return 0;[/code]
            Last edited by sicarie; Sep 13 '07, 12:28 PM. Reason: Code tags

            Comment

            • ifitzgerald
              New Member
              • Sep 2007
              • 9

              #7
              Originally posted by audiokarate
              Alright so this is what I have so far. Now all I have to do is to output a customer report for example:

              Base charge: $12.95
              Local call charge: (value will be based on user’s input)
              Long distance charge: (value will be based on user’s input)
              Total Bill: (value will be based on user’s input)

              This has got to show at the bottom after the bill is calculated and I am having trouble with it. I just need to get pointed in the right direction. How do I find the local call charge and input it where the parenthesis are?



              //Assignment_1.cp p
              //ER
              //Program Purpose: Create a program that will compute telephone
              //bills for the local telephone company

              #include <iostream>
              #include <iomanip>
              using namespace std;

              int main()
              {

              const double LOCAL_RATE = 0.10; //RATE OF LOCAL CALLS
              const double LONG_D_RATE = 0.15; //RATE OF LONG D CALLS
              const double TAX_RATE = 8.72; //FIXED TAX RATE

              double base = 12.95; //Base charger per month
              double local_calls = 0;
              double long_distance = 0;
              double total = 0;

              cout << setprecision(2)
              << setiosflags(ios ::fixed)
              << setiosflags(ios ::showpoint);


              cout << "***Bayside Telephone Company*** "<< endl << endl;
              cout << endl;

              cout << "Enter number of local calls made during the month : ";
              cin >> local_calls;
              cout << endl;
              cout << "Enter number of long distance calls made during the month : ";
              cin >> long_distance;
              cout << endl;


              base += local_calls * LOCAL_RATE;
              base += long_distance * LONG_D_RATE;
              base *= 1.0872;

              cout << "The total bill for this month is : $" << base;
              cout << endl;

              return 0;
              You're already calculating that value here:
              [code=c]base += local_calls * LOCAL_RATE;[/code]
              Either recalculate the value in-line with a cout like this:
              [code=c]cout<< "Total Charges for Local calls: " << local_calls * LOCAL_RATE << endl;[/code]
              or store the result of the first calculation in a variable, e.g.
              [code=c]
              double localCharges = local_calls * LOCAL_RATE;
              base += localCharges;
              .
              .
              .
              cout << "Total Charges for Local Calls: " << localCharges << endl;
              [/code]

              Hope this helps,
              Ian

              Comment

              • audiokarate
                New Member
                • Sep 2007
                • 16

                #8
                Originally posted by ifitzgerald
                You're already calculating that value here:
                [code=c]base += local_calls * LOCAL_RATE;[/code]
                Either recalculate the value in-line with a cout like this:
                [code=c]cout<< "Total Charges for Local calls: " << local_calls * LOCAL_RATE << endl;[/code]
                or store the result of the first calculation in a variable, e.g.
                [code=c]
                double localCharges = local_calls * LOCAL_RATE;
                base += localCharges;
                .
                .
                .
                cout << "Total Charges for Local Calls: " << localCharges << endl;
                [/code]

                Hope this helps,
                Ian


                yah man..thanks helped out alot.

                Comment

                Working...