Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<fstream>
- #include <iostream>
- #include <string>
- using namespace std;
- /*
- Name: Alberto Pereira Total Points: 10
- Due Date: 2/4/2013
- Course: C0P3014
- Assignment: Assignment 1
- Professor: Dr. Lofton Bullard
- Description:This program takes inputs from the user and calculates the amount a user
- is charged for making a phone call */
- int main()
- {
- string cell_num;
- int relays;
- int call_time;
- float net_cost = 0.00;
- float call_tax = 0.00;
- float total_cost = 0.00;
- float tax_rate = 0.00;
- /*Gets the phone number, call time and number of relays made by the user
- for the phone call */
- cout << "Please enter your cell phone number here: \n";
- cin >> cell_num;
- cout << "Please enter the length of your call in minutes here: \n";
- cin >> call_time;
- cout << "Please enter the number of relays here: \n";
- cin >> relays;
- /* calculates the take rate for the phone call made by the user */
- if(relays>=0 && relays<=5)
- {
- tax_rate=1;
- }
- else if(relays>=6 && relays<=11)
- {
- tax_rate=3;
- }
- else if(relays>=12 && relays<=20)
- {
- tax_rate=5;
- }
- else if(relays>=21 && relays<=50)
- {
- tax_rate=8;
- }
- else if(relays>50)
- {
- tax_rate=12;
- }
- /* calculates the net cose, the tax for the call and the total cost
- of the phone call made by the user. */
- net_cost = relays/50.0 * 0.40 * call_time;
- call_tax = net_cost* tax_rate/100;
- total_cost = net_cost + call_tax;
- /* outputs */
- cout << "Cell phone number: " << cell_num << "\n";
- cout << "Number of relays stations for the call: " << relays << "\n";
- cout << "Minutes used: " << call_time << " minutes\n";
- cout << "The net cost of the call is: " << net_cost << "\n";
- cout << "The tax of the call is: " << call_tax << "\n";
- cout << "The total cost of the call is: " << total_cost << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement