Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 132,340 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,111 people online right now. Registration is fast and FREE... Join Now!




Billing Problem

 
Reply to this topicStart new topic

Billing Problem, IT WONT WORK !!!!

Dopest3thiopian
post 12 Mar, 2008 - 05:42 PM
Post #1


New D.I.C Head

*
Joined: 1 Mar, 2008
Posts: 1

#include<iostream>
#include<fstream>
#include<iomanip>

using namespace std;

int main()
{
const double reg_service = 10.00;
const double reg_extrafee = 0.20;
const double prem_service = 25.00;
const double prem_extradayfee = 0.10;
const double prem_extranightfee = 0.05;

ifstream inFile;
ofstream outFile;

int num1;
int accountnum;
int daymins;
int nightmins;
int regmins;
int extramins;
char servicetype;
double amountdue;
double charge;

inFile.open("c:\\telephoneinput.txt");
outFile.open("c:\\telephoneresults.txt");



outFile << fixed << showpoint;
outFile << setprecision(2);



//outFile << "Please enter your account number, service code, number of minutes used: ";
inFile >> servicetype >>accountnum;


while(inFile)
{

switch (servicetype)
{
case 'r':
case 'R':

amountdue = (regmins * reg_extrafee)+ reg_service;
break;

if(regmins <=50)
{
outFile << "Accout Number: "<< accountnum <<" Amount Due:" << " $ " << amountdue <<endl;
break;

case 'p':
case 'P':
}
else

amountdue = (daymins * prem_extradayfee) + prem_service;
outFile << "Account Number: "
<< accountnum
<< endl;
outFile << "Amount Due:" << " $ " << amountdue <<endl;



}



inFile.close();
outFile.close();
}


system("pause");
return 0;
}


Write a program that calculates and prints the bill for a cellular telephone company. The company offers two types of service: regular and premium. Its rates vary, depending on the type of service. The rates are computed as follows:

Regular service: $10.00 plus first 50 minutes are free. Charges for over 50 minutes are $0.20 per minutes.

Premium service: $ 25.00 plus:

a. For calls made from 6am-6pm, the first 75 minutes are free; charges for over 75 minutes are $0.10 per minute.

b. for calls made from 6pm-6am, the first 100 minutes are free; charges for over 100 minutes are $0.05 per minute.

Your program should output a service code, account number and the number of minutes used. A service code of r or R for regular service; a service code of p or P for premium service. Treat any other code as any error.



Attached File(s)
Attached File  telephoneinput.txt ( 160bytes ) Number of downloads: 12
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 11/22/08 03:37AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month