You work for a cable company and are designing a software system to automate the
ID: 3664538 • Letter: Y
Question
You work for a cable company and are designing a software system to automate the
customer service system. Your system is archaic, so you can only read in the inputs 1
through 4, `y’ `n’ and `q’ from your user (the current customer).
When your program begins, display the following menu to the user:
[prompt]$./customer_experience
WelcometoCableCom!Pleasemakeachoicefromthefollowingoptions:
1)Changeyourpassword
2)Cancelyourservice
3)Scheduleaservicecall
4)Payyourbill
Your system then asks a series of questions. After picking an option, ask the user if
they would like to upgrade their service. A service upgrade message looks like this:
Youareeligibleforalimitedtimeoffer.Youcanget%dmegabits
persecondforthelowpromotionalrateof$%damonth.Actnowwhile
supplieslast.
Here, the two %dvariables depend on the options and the user’s actions (specified
below). They may either input `y’ for yes, `n’ for no, or `q’ for quit. If at any point in
time the user enters `y’, they have decided to upgrade their service! Congratulate them
by printing:
Greatchoice.Goodbye.
4
And exit the program. Your service upgrade messages and behavior on `q’ is as
follows, depending on the option chosen above:
Option 1
Begin your service upgrade at 10 megabits per second for $50 dollars a
month. Every time the customer enters `n’ or `q’, increase both the
megabits per second and dollars a month by 1.
After any prompt, exit if `q’ has been pressed twice (not necessarily in a
row).
That is the program I'm supposed to construct and I have the following codes so far:
#include
#include
int main() {
int entry;
printf("Welcome to CableCom! Please make a choice from the following options: 1) Change your password 2) Cancel your service 3) Schedule a service call 4) Pay your bill");
scanf("%d", &entry);
while (entry < 1 || entry > 4)
printf("Please enter a number between 1 and 4.")
(entry => 1 && entry =<4)
I do not know how to proceed from here and would really appreciate help completing this. I'm using C programming language.
Explanation / Answer
#include<stdio.h>
void main()
{
int mbpersec;
int fee;
int choice1;
char choice2;
int qcounter=0;
int flag=1;
mbpersec=10;
fee=50;
while(flag)
{
printf(" WelcometoCableCom!Pleasemakeachoicefromthefollowingoptions: ");
printf("1.Changeyourpassword ");
printf("2.Cancelyourservice ");
printf("3.Scheduleaservicecall ");
printf("4.Payyourbill ");
scanf(" %d",&choice1);
printf("service %d selected by customer. Displaying current offer below ",choice1);
fflush(stdin);
if(choice1 >=1 && choice1 <= 4){
printf(" Youcanget%dmegabitspersecondforthelowpromotionalrateof$%damonth.Actnowwhilesupplieslast. ",mbpersec,fee);
printf(" Enter y/n/q : ");
scanf(" %c", &choice2 );
fflush(stdin);
switch(choice2){
case 'y':
printf("Greatchoice.Goodbye. ");
printf("4 ");
flag=0;
break;
case 'n':
mbpersec=mbpersec+1;
fee=fee+1;
break;
case 'q':
mbpersec=mbpersec+1;
fee=fee+1;
qcounter=qcounter+1;
if(qcounter==2){flag=0;}
break;
}
}else{
printf("Please enter your choice between 1 to 4 only ");
continue;
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.