Starting from:

$30

CS201-Homework 1 International Phone Roaming Costs Solved

In this homework, you will write a C++ program that performs a basic calculation on the bill of your international phone usage when you are abroad, which is also called roaming. User name, the price of outgoing call per minute, the minutes talked in outgoing calls, the price of incoming call per minute, minutes talked in incoming calls, the price of internet usage per MB, the number of GB’s of internet used, the price of one SMS, and the number of SMS’s sent will be the inputs of the program. Your program will calculate the phone bill for each of the outgoing calls, the incomings calls, the internet usage and the SMS’s. Additionally, your program will also calculate the total cost of all these roaming services with 18% tax imposed and the total roaming bill fee including the tax.

All program flow may be computed in the main function. i.e. you are not expected to write any user-defined functions, but of course you can write some, if you prefer to do so.

 

Programming Language/Environment
You should prepare (or at least test) your program using MS Visual Studio 2012 C++. We will use the standard C++ compiler and libraries of the above mentioned platform while testing your homework.

Input and Output
There are nine inputs in this program:

•          Name of the user (of type string),

•          Price of outgoing call per minute in TL (of type double),

•          Number of minutes talked as outgoing calls (of type int),

•          Price of incoming call per minute in TL (of type double),

•          Number of minutes talked as incoming calls (of type int),

•          Price of internet usage per MB in TL (of type double),

•          GBs of internet used (of type double),

•          Price of one international SMS in TL (of type double),

•          Number of SMS’s sent (of type int).

Seven outputs are expected in this program, all in terms of TL:

•          Money spent for outgoing calls (of type double),

•          Money spent for incoming calls (of type double),

•          Money spent for the internet usage (of type double),

•          Money spent for the SMS’s (of type double),

•          Total cost of all roaming services (of type double), •    The tax imposed, 18% of the total cost (of type double),

•          Total roaming bill fee including the tax (of type double).

Program Flow
At the beginning, the user will be prompted to enter his/her name as the first input. The name of the user should be displayed whenever appropriate in the prompts and the output text. See Sample Runs section for some examples.

User will first input his/her name. After that, two prompts will be received that want the user to enter the price of outgoing call per minute and the minutes talked as outgoing call. Then, your program will calculate and display the amount spent for outgoing calls while roaming. After that, two other prompts will be received that want the user to enter the price of incoming call per minute and the minutes talked as incoming call. Then, your program will calculate and display the amount spent for incoming calls while roaming. After that, another two prompts will be received that want the user to enter the price of internet usage per MB and the number of GB’s of internet used while roaming. Then, your program will calculate and display the amount spent for internet usage while roaming. Thereafter, another two prompts will be received that ask for the user to enter the price of one SMS and the number of SMS’s sent. Then, your program will calculate and display the amount spent for the SMS’s. See Sample Runs section for some examples.

Then, your program should also calculate and display the remaining expected outputs: total cost of all the used services, the tax imposed on it (18% of the total cost) and the total bill fee including the tax.

Please refer to the Sample Runs section to see the program flow.

Input Check
You do not need to perform any kind of input checks; you may assume that the user enters positive values correctly for all inputs.

 

Sample Runs
Below, we provide some sample runs of the program that you will develop. The italic and bold phrases are inputs taken from the user. You should follow the input order in these examples and the text your program will display must be exactly the same as in the following examples.

Sample Run 1

Please enter your name: Gulsen

Gulsen, please enter the price for outgoing call per minute: 10

Gulsen, please enter how many minutes you have talked in outgoing calls: 5

Gulsen, you have spent 50 TL for outgoing calls you made while you are abroad.

Gulsen, please enter the price for incoming call per minute: 3

Gulsen, please enter how many minutes you have talked in incoming calls: 12 Gulsen, you have spent 36 TL for incoming calls you made while you are abroad.

Gulsen, please enter the price for internet usage per MB: 5

Gulsen, please enter how many GBs you have used: 1

Gulsen, you have spent 5120 TL for the internet while you are abroad.

Gulsen, please enter the price for one SMS: 1

Gulsen, please enter the number of SMS you have sent: 7

Gulsen, you have spent 7 TL for the SMS while you are abroad.

Gulsen, total cost for all roaming services is 5213 TL.

Gulsen, tax is 938.34 TL.

Gulsen, total roaming bill fee with tax is 6151.34 TL.

Sample Run 2

Please enter your name: Ece

Ece, please enter the price for outgoing call per minute: 4.90

Ece, please enter how many minutes you have talked in outgoing calls: 17

 

Ece, you have spent 83.3 TL for outgoing calls you made while you are abroad.

Ece, please enter the price for incoming call per minute: 2.90

Ece, please enter how many minutes you have talked in incoming calls: 8 Ece, you have spent 23.2 TL for incoming calls you made while you are abroad.

Ece, please enter the price for internet usage per MB: 5

Ece, please enter how many GBs you have used: 0.028

Ece, you have spent 143.36 TL for the internet while you are abroad.

Ece, please enter the price for one SMS: 0.95

Ece, please enter the number of SMS you have sent: 5

Ece, you have spent 4.75 TL for the SMS while you are abroad.

Ece, total cost for all roaming services is 254.61 TL.

Ece, tax is 45.8298 TL.

Ece, total roaming bill fee with tax is 300.44 TL.

More products