473,395 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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.
Sep 6 '07 #1
7 1836
Ganon11
3,652 Expert 2GB
Which parts exactly are you having trouble with?
Sep 6 '07 #2
finding the variables..I already know the constants
Sep 6 '07 #3
This is what I have so far and I'm not sure if it's correct either.
Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. void main ()
  6. {
  7.  
  8.       Const double BASE_CHARGE_PER_MONTH = 12.95;
  9.       Const double RATE_LOCAL_CALLS = 0.10;
  10.       Const double TAX_RATE = 8.72;
  11.  
and thats it?
Sep 6 '07 #4
Studlyami
464 Expert 256MB
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.
Sep 7 '07 #5
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?


Expand|Select|Wrap|Line Numbers
  1. //Assignment_1.cpp
  2. //ER
  3. //Program Purpose: Create a program that will compute telephone
  4. //bills for the local telephone company
  5.  
  6. #include <iostream>
  7. #include <iomanip>
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.  
  13. const double LOCAL_RATE = 0.10;           //RATE OF LOCAL CALLS
  14. const double LONG_D_RATE = 0.15;         //RATE OF LONG D CALLS
  15. const double TAX_RATE = 8.72;              //FIXED TAX RATE
  16.  
  17. double base = 12.95;                           //Base charger per month
  18. double local_calls = 0;
  19. double long_distance = 0;
  20. double total = 0;
  21.  
  22.    cout << setprecision(2)
  23.         << setiosflags(ios::fixed)
  24.         << setiosflags(ios::showpoint);
  25.  
  26.  
  27.    cout << "***Bayside Telephone Company***                                  "<< endl  << endl;
  28.    cout << endl;
  29.  
  30.    cout << "Enter number of local calls made during the month : ";
  31.    cin  >> local_calls;
  32.    cout << endl;
  33.    cout << "Enter number of long distance calls made during the month : ";
  34.    cin  >> long_distance;
  35.    cout << endl;
  36.  
  37.  
  38.    base += local_calls * LOCAL_RATE;
  39.    base += long_distance * LONG_D_RATE;
  40.    base *= 1.0872;
  41.  
  42.    cout << "The total bill for this month is : $" << base;
  43.    cout << endl;
  44.  
  45.    return 0;
Sep 12 '07 #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?



//Assignment_1.cpp
//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:
Expand|Select|Wrap|Line Numbers
  1. base += local_calls * LOCAL_RATE;
Either recalculate the value in-line with a cout like this:
Expand|Select|Wrap|Line Numbers
  1. cout<< "Total Charges for Local calls: " << local_calls * LOCAL_RATE << endl;
or store the result of the first calculation in a variable, e.g.
Expand|Select|Wrap|Line Numbers
  1. double localCharges = local_calls * LOCAL_RATE;
  2. base += localCharges;
  3. .
  4. .
  5. .
  6. cout << "Total Charges for Local Calls: " << localCharges << endl;
  7.  
Hope this helps,
Ian
Sep 13 '07 #7
You're already calculating that value here:
Expand|Select|Wrap|Line Numbers
  1. base += local_calls * LOCAL_RATE;
Either recalculate the value in-line with a cout like this:
Expand|Select|Wrap|Line Numbers
  1. cout<< "Total Charges for Local calls: " << local_calls * LOCAL_RATE << endl;
or store the result of the first calculation in a variable, e.g.
Expand|Select|Wrap|Line Numbers
  1. double localCharges = local_calls * LOCAL_RATE;
  2. base += localCharges;
  3. .
  4. .
  5. .
  6. cout << "Total Charges for Local Calls: " << localCharges << endl;
  7.  
Hope this helps,
Ian


yah man..thanks helped out alot.
Sep 13 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Sunil Chaudhary | last post by:
JOB SUMMARY: The Business Analyst will be responsible for much of the modeling, tracking, reporting, analysis, and forecasting. The successful candidate will work with Business Managers to...
5
by: G. Stewart | last post by:
The word "Business" in the term implies some sort of commercial aspects or connotations. But from what I can see, that is not necesserially the case at all? So what is the reasoning behind the...
0
by: Vendell | last post by:
Join one of Canada's finest business men... Dear entrepreneur colleague: Here is a message from the founder.... Let me introduce myself. My name is Ariel Topf. I am 42 years old and I have...
1
by: Nemisis | last post by:
hi guys, Currently converting an old classic asp system to a OOP asp.net application. We are building the new application using a 3 tier arcitecture and i was wondering about the following. ...
25
by: Penelope Dramas | last post by:
Hello, I'm in a front of very serious .net redesign/rewrite of an old VB6 application. I had been asked to make it .NET 2.0 and would like to ask couple of questions regarding data access as...
2
by: grawsha2000 | last post by:
Greetings, I am developing this N-tier business app. The problem I'm facing is when I try to pass business objects (employees, dept..etc) from business tier to data tier,i.e., the add method in...
8
by: morleyc | last post by:
Hi, until recently i was quite happy to add data sources from mssql database in visual studio and drag the datasets directly onto the form this creating a directly editable form which worked well....
0
by: YellowFin Announcements | last post by:
Yellowfin, Powered by J2EE, Jasper, BIRT, Spring, jfreeChart Advanta releases ATLAS BI using Yellowfin Business Intelligence 3rd of August, 2007 - Advanta Software, specialist software...
9
by: SAL | last post by:
Hello, I have a Dataset that I have table adapters in I designed using the designer (DataLayer). I have a business logic layer that immulates the DataLayer which may/may not have additional logic...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.