View Single Post
Old 03-06-2005, 07:44 AM   #5 (permalink)
Aznxmel
Registered User
 
Join Date: Mar 2005
Posts: 3
Aznxmel is on a distinguished road
Thanks Valmont, im still having errors because of the curly brackets or too many if else stamtements but your code worked
Code:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <math.h>
 
using namespace std;
 
void main ()
{
 double accountNumber (0.0);
 double minutesUsed (0.0), totalMinutes (0.0), minutesUsedInDay (0.0);
 double minutesUsedInNight (0.0), amountDueByUser (0.0), balanceDue(0.0);
 double  premiumDay (0.0), premiumNight (0.0);
 char service (' '), dayOrNight (' ');
//                             Basic Input
    cout << "\n We will now Calculate your Bill" << endl;
 cout << "\n Input Values when prompted" << endl;
 cout << "\n Enter Account Number";
 cin >> accountNumber;
 cout << "\n Enter Service Code 'R' for Regular, 'P' for Premium"; 
 cin >> service;
//      The Start of using If/Else Statemenets
//          Calculating Regular Account
if(service == 'R' || service == 'r')
{
 cout<< "\n Welcome to your Regular Account";
 cout<< "\n Enter Minutes Used"; 
 cin >> minutesUsed ;
   if (minutesUsed <= 50) 
    balanceDue = minutesUsed + 10;
    cout<< "\n Balance Due: "; balanceDue;
   else 
    balanceDue = ((minutesUsed - 50) * .20) + 10;
    cout<< "\n Balance Due:"; balanceDue;
}
else
//      Calculating Premium Account
if(service == 'p' || service == 'P')
{
 cout<< "\n\n Welcome to your Premium Account";
 cout<< "\n\n Chose 'D' for Day Or 'N' for Night";
 cin >> dayOrNight;
}
//      Calculating Day Time Minutes
 if (dayOrNight == 'D'|| dayOrNight == 'd')
{
 cout<< "\n\n Welcome to your Preium Day Account";
 cout<< "\n\n Enter Day time Minutes Used ";
 cin>> premiumDay; 
  if(minutesUsedInDay <= 75)
   cout<< "\n Premium Day Balance"; premiumDay;
  else 
   premiumDay = ((minutesUsedInDay - 75) * .10);
   cout<< "\n Balance Due:"; premiumDay; 
}
//      Calculating Night Time Minutes
else
 if (dayOrNight == 'N'|| dayOrNight == 'n')
{
 cout<< "\n Welcome to your Premium Night Account";
 cout<< "\n Enter Night time Minutes Used";
 cin>> premiumNight;
  if (premiumNight  <= 100)
    cout<< "\n Premium Night Balance"; premiumNight;
   else 
    premiumNight = (premiumNight - 100) * .05; 
    cout<< "\n Premium Night Balance"; premiumNight;
}
//Return
 return 0;
}

Last edited by redhead; 03-06-2005 at 01:31 PM. Reason: Use [ code] tags
Aznxmel is offline   Reply With Quote