In: Computer Science
The Dash Cell Phone Company charges customers a basic rate of $5
per month to send text messages. Additional rates are as
follows:
Design a flowchart or pseudocode for the following:
a. A program that accepts the following data about one customer's
messages: area code (three digits), phone number (seven digits),
and number of text messages sent. Display all the data, including
the month-end bill both before and after taxes are added.
b. A program that continuously accepts data about text messages
until a sentinel value is entered, and displays all the
details.
c. A program that continuously accepts data about text messages
until a sentinel value is entered, and displays details only about
customers who send more than 100 text messages.
d. A program that continuously accepts data about text messages
until a sentinel value is entered, and displays details only about
customers whose total bill with taxes is over $10.
e. A program that prompts the user for a three-digit area code from
which to select bills. Then the program continuously accepts text
message data until a sentinel value is entered, and displays data
only for messages sent from the specified area code.
Hey, here's the pseudo-code for question number "a".
a) Pseudocode:
Start
Declarations of variables
int val_basic = 5
int val_area
int val_phone
int val_sent
int val_rate = 0.12
int val_total
int val_bill
int val_remi
now call every method.
accept_Data ( )
calculate_Bill ( )
Display ( )
Stop
Now, we have to write the code for the above functions.
Accept_Data ( )
Get the input from the user.
print “Enter area code (only 3 digits)”
input val_area
print “Enter phone number (only 7 digits)”
input val_phone
print “Enter messages count sent in a month”
input val_sent
return
calculate_Bill ( )
//if condition
if val_sent < 60 then
val_total = val_basic
val_bill = val_total + (val_total * val_rate)
else
if val_sent > = 60 AND val_sent < 180 then
val_remi = val_sent - 59
val_total = val_basic + (val_remi * 0.05)
val_bill = val_total + (val_total * val_rate)
else
if val_sent > = 180 then
val_remi = val_sent – 179
val_total = val_basic + (val_remi * 0.10 )
val_bill = val_total + (val_total * val_rate)
endif
endif
endif
return
Display ( )
print “val_phone number is”, val_area, val_phone
print “no. of messages sent are”, val_sent
print “total amount excluding taxes is $”, val_total
print “bill amount including taxes is $”, val_bill
Return
I hope you find it useful, if you have any query please comment down
Thanks,