C class Please i need your help guys De writing a program th
Solution
Program simulating isp(internet service provider)that provides dedicated service for small businesses
# include<iostream>
 
 # include<fstream>
# include<conio.h>
 
 using namespace std;
 
 
 int main()
 
 {
double consumed_time;
 
 int start_hour, start_min, end_hour, end_min;
 
 double discount_cost=0.00,gross_cost=0.00;
 
 double discount_rate=0.15 ;
 
 int new_hour_start, new_hour_end, start_time, end_time;
 
 int regular_rate = 20;
 
 double promo_rate = 15;
 
 char customer_name[20];
 
 double total_cost=0.00;
 
 char ans=\'Y\';
 
 char month[12];
double date,year;
 
 double consumed_new, amount, change;
 
 
 ofstream bill;
 
 bill.open(\"Monitoring Record.txt\");
 
 cout<<endl<<endl;
 
 system(\"cls\");
   
 cout<<\" Enter date: [mm/dd/yy]\";
 
 cin>>month>>date>>year;
 
 bill<<\"\  Date: \"<<date;
while( ans==\'Y\' || ans==\'y\')
{
cout<<\"\ \ \\tEnter customer\'s name: \";
 
 cin>>customer_name;
 
 bill<<\"\  Customer\'s Name:\"<<customer_name;
 
 cout<<\"\ \\tEnter the start hour in 24 hour \";
 
 cin>>start_hour;
 
 cout<<\"\ \\tIn minutes.: \";
 
 cin>>start_min;
 
 cout<<\"\ \\tEnter the end hour in 24 hour \";
 
 cin>>end_hour;
 
 cout<<\"\ \\tIn minutes.: \";
 
 cin>>end_min;
 
 new_hour_start = start_hour * 60;
 
 start_time =start_min + new_hour_start;
 
 new_hour_end = end_hour * 60;
 
 end_time = end_min + new_hour_end;
 
 consumed_time = (end_time - start_time);
 
 consumed_new = consumed_time / 60;
 
 bill<<\"\  You used :\"<< consumed_new<<\"hours\";
 
 
 
 if(start_hour<=8 || start_hour==12 || end_hour<=12)
 
 {
 
 gross_cost = (consumed_time * promo_rate)/60;
 
 cout<<\"\ \\tYour gross cost is: \"<<gross_cost<<endl;
 
 
 }
 
 
 else if(start_hour>=13 && end_hour<=22)
 
 {
 
 gross_cost = (consumed_time * regular_rate)/60;
 
 cout<<\"\ \\tYour gross cost is: \"<<gross_cost<<endl;
 
 if(consumed_time>=180)
 
 {
 
 discount_cost = gross_cost * discount_rate;
 
 cout<<\"\ \\tYour discount is: \"<<discount_cost<<endl;
 
 
 }
 
 else if(consumed_time <180)
 
 {
 
 discount_cost = 0;
 
 cout<<\"\ \\tYou have no discount!\" <<endl;
 
 
 
 }
 
 else
 
 cout<<\"\ \\tInvalid input\";
 
 }
 
 
 
 else
 
 cout<<\"\ \\tInvalid input.\";
 
 
 bill<<\"\  Sub-total is :\" <<gross_cost;
 
 bill<<\"\  Discount : \"<<discount_cost;
 
 total_cost = gross_cost - discount_cost;
 
 cout<<\"\ \\tYour total bill is : \"<<total_cost<<endl;
 bill<<\"\  Total bill is : \"<<total_cost<<endl;
 
 cout<<\"\ \\tEnter amount: \";
 
 cin>>amount;
 
 malou:
 
 if(amount<=total_cost)
 {
 cout<<\"\ \\tInvalid Amount \"<<endl;
 
 cout<<\"\ \\tEnter amount: \";
 
 cin>>amount;
 
 goto malou;
 }
 
 else if (amount>=total_cost)
 {
 
 change = amount - total_cost;
 cout<<\"\ \\tYour change is : \"<<change<<endl;
 }
 else
 cout<<\"Invalid input..\";
 
 bill<<\"Amount : \"<<amount<<endl;
 
 bill<<\" _______________\"<<endl;
 
 bill<<\"Your change is : \"<<change<<endl;
 cout<<endl;
 
 
 cin>>ans;
 cout<<endl;
 
 bill<<\"\\t\\t\\t***************************\"<<endl;
}/*end while */
 
 
 bill.close();
 
 
 return 0;
 }




