#include <iostream.h>
#include <conio.h>
int main()
{
clrscr();
long int units,charge=0;
float total;
const int rent=25;
cout << "Enter the number of units used : ";
cin>>units;
if(units>200)
charge=(units-200)*20+150*40+50*60;
else if(units>50)
charge=(units-50)*40+50*60;
else
charge=units*60;
total=0.01*charge+rent;
cout << "You have used " << units << " units." << endl;
cout << "Your total telephone bill is $" << total;
getch();
return 0;
Please accept the solution. Thanks, Lucy
}
This program takes in the number of units used ('units') as a screen input from the user.
It then calculates the total telephone bill for the customer on the following basis :
A compulsory fee of $25, plus
60 cents per unit for the first 50 units,
40 cents per unit for the next 150 units,
20 cents per unit for anything above 200 units.
It then outputs the bill using the 'cout' command.
The Batch button allows you to count bills in batches from 1 - 999. For example, if you want to sort into piles of 100 bills, the machine will count 100 bills, then stops. Once you remove those 100 bills, it will continue to count the next batch of 100 bills, then stops again. The machine is preset to common counting mode, To count bills in batches, press BATCH. Batching is preset to 100 bills. To change batch amount, press C to clear, and use the keypad to enter a batch number between 1 and 999. Press SET to save the setting.
272 views
Usually answered in minutes!
×