can i ask for a help? can you give me an idea to improve our program? another feature? our program is about computing a telephone bill..
-thanks!-

Recommended Answers

All 6 Replies

Now how in hell do you think anyone can answer that question? "My car is broke, please make it better".

> can i ask for a help? can you give me an idea to improve our program? another feature?
Yes, no, maybe are my answers.

this is codes..

#include<stdio.h>
#include<stdlib.h>
#include<iostream.h>
#include<iomanip.h>

class Globe
{
public:
void acctdetails(void)
{
cout<<"Input Customer id:";
cin>>id;
cout<<"Input Account Number:";
cin>>acctno;
cout<<"Plan:";
cin>>plan;
switch(plan)
{
case 'A':
addsms=1;
addmins=7;
frees=500;
freec=20;
flat=500;
break;
case 'B':
addsms=1;
addmins=7;
frees=800;
freec=40;
flat=800;
break;
case 'C':
addsms=1;
addmins=7;
frees=1200;
freec=60;
flat=1200;
break;
case 'D':
addsms=0.50;
addmins=4;
frees=1400;
freec=100;
flat=1400;
break;
case 'E':
addsms=0.50;
addmins=4;
frees=1800;
freec=120;
flat=1800;
break;
case 'F':
addsms=0.50;
addmins=4;
frees=2000;
freec=140;
flat=2000;
break;
}
cout<<"Input SMS consumption:";
cin>>sms;
cout<<"Input call consumption(mins.):";
cin>>call;
}

void totalcomp(void)
{
tot=flat+((sms-frees)*addsms)+((call-freec)*addmins);
cout<<"Input Previous Bill:";cin>>prev;
cout<<"Total Payable:";
cout<<tot+prev<<endl;
cout<<endl;
}
private:
char id[20];
int acctno;
char plan;
int sms;
int call;
float addsms;
float addmins;
int frees;
int freec;
float tot;
float prev;
int flat;
};

void main(void)
{
Globe deo;
deo.acctdetails();
deo.totalcomp();
}

Well indentation would be nice.

As currently written you will be able to handle one customers account per run of the program. While that might be an appropriate initial step in the assignment, I presume that the final assignment will require that the user be able to enter more than one customer information per run of the program and that it can be terminated whenever the user wishes. If that assumption is correct, then looking at a control loop someplace would improve the program.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.