Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Program 1: Design (pseudocode) and implement (source code) a program (name it Ph

ID: 3746435 • Letter: P

Question

Program 1: Design (pseudocode) and implement (source code) a program (name it PhoneBil1) that calculates the bill for a cellular telephone company. The company offers two types of service: regular servicer and premium service. The rates vary depending on the type of service. The rates are computed as follows: $15.00 fee covering first 50 minutes. Charges for over 50 minutes are computed at the rate of $0.50 per minute. Regular service: Premium service: $25.00 fee plus: For daytime calls (between 6:00AM to 6:00PM), the first 50 minutes are free; charges for over 50 minutes are computed at the rate of $0.20 per minute. For nighttime calls (between 6:00PM to 6:00AM), the first 100 minutes are free; charges for over 100 minutes are computed at the rate of 0.10 per minute. a. b. The program prompts the user to enter an account number, a service code (of type char), and the number of minutes the service was used. A service code r (or R) means regular service; while code p (or P) means premium service. If the service is premium (code p or P), the customer may be using the service during both the day and night. Therefore, the program must ask the user to input the number of minutes used during daytime and nighttime in separate prompts. Document your code and properly label the input prompts and the outputs as shown below. Sample run 1: Account Number: Service type: Total minutes: Amount due: 12345 Regular 50 $15.00

Explanation / Answer

Hi as the programming language is not mentioned I would like to explain it using C++. Code logic will be the same except the syntax . So you can change it accordingly. If you still feel difficult to convert the code in some other language then you can put your query under the comment section. And i will be happy to help.

1. Please find below the pseudocode :

1.Enter the Account Number
2.Enter the Service Code
3. If Premium Service then
a.Enter number of used day minutes
b.Enter number of used night minutes
i) if premium day minutes is greater than 50 then
then total bill= (premium day minutes - 50) * premium day rate
if premium night minutes is greater than 100 then
then total bill= (premium night minutes - 100) * premium night rate
ii) total bill = total bill + premium account fee
4. else if Regular Service then
a.Enter the number of used minutes
i) if regular minutes used is greater than 50 then
total bill = ((regular minutes used - 50) * Regular Rate) + Regular account fee
else
total bill = regular account fee
5. else
print : "you entered invalid service code"
6. print: "your bill" - total bill

2.Please find below the programming Code:

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

int pre_night_min,reg_min_used,acc_num, pre_day_min;

char ser_code;

float tot_bill = 0;

  

const float pre_day_rate = 0.20;

const float Reg_acc_fee = 15.00;

const float reg_rate = 0.50;

const float pre_night_rate = 0.10;

const float pre_acc_fee = 25.00;

  

  

cout << "Please Enter Account Number : "; // you will ask the user to input the account number

cin >> acc_num;

cout << "Please Enter Service Code : "; // you will ask for service code selection

cin >> ser_code;

  

switch (ser_code) {

case 'p':

case 'P':// if you select p or P for premium service

cout << "Please Enter Number of Used Day Minutes: ";// ask to enter the used day minutes

cin >> pre_day_min;

cout << "Please Enter Number of Used Night Minutes: ";// ask to enter the night minutes

cin >> pre_night_min;

if (pre_day_min > 50) {

tot_bill = (pre_day_min - 50) * pre_day_rate;

}

if (pre_night_min > 100) {

tot_bill = (pre_night_min - 100) * pre_night_rate;// calculations as per the conditions

}

tot_bill += pre_acc_fee;

break;

case 'r':

case 'R':

cout << "Please Enter Number of Used Minutes: ";

cin >> reg_min_used;

if (reg_min_used > 50) {

tot_bill = ((reg_min_used - 50) * reg_rate) + Reg_acc_fee;// calculations as per the conditions

} else {

tot_bill = Reg_acc_fee;

}

break;

default:

cout << "Service Code Entered is Invalid" << endl; // if you entered a wrong service code it will prompt invalid code

return 1;

break;

}

cout << "Your bill is: $" << tot_bill << endl;

  

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote