Using the pseudo code below, write the code that will meet the requirements:
Main Function
D...
Computers and Technology, 22.04.2021 22:00 aarionna8
Using the pseudo code below, write the code that will meet the requirements:
Main Function
Declare the char variables for the 8 digits of the phone number
while true
Call the ReadDials function passing the 8 digits
by reference. ReadDials returns an error code by
value.
If the return value is -5, exit the do while loop
If the error code is -1, display the
error message "ERROR - An invalid character was entered".
If the error code is -2, display the
error message "ERROR - Phone number cannot begin with 0".
If the error code is -3, display the
error message "ERROR - Phone number cannot begin with 555".
If the error code is -4, display the
error message "ERROR - Hyphen is not in the correct position".
Otherwise, call the AcknowledgeCall function
End-While
ReadDials function
Input the first digit
If a Q was entered, return -5.
Input the rest of the phone number
Call the ToDigit function for each of the 7 digits
not for digit 4
If ToDigit returns -1, return -1
If digit 4 is not a hyphen, return -4.
If digit 1 is 0, return -2.
If digits 1 - 3 are 5, return -3
Otherwise, return 0
ToDigit function
Convert the digit to upper case
Use a switch statement to determine if the digit is valid
and convert the letters to digits
If the digit is invalid, return -1.
If the digit is valid, return 0.
AcknowledgeCall function
Display the Phone Number
this is what I got so far:
#include
using namespace std;
char ReadDials(char d1,char d2,char d3,char d4,char d5,char d6,char d7,char d8);//function prototype
ToDigit() function prototype
AcknowledgeCall() function prototype
int main()
{
char d1=0,d2=0,d3=0,d4=0,d5=0,d6=0,d7=0, d8=0;//declare variables for digits
cout<<"Enter digits, separated by a space.";
cin >> d1 >> d2 >> d3 >> d4 >> d5 >> d6 >> d7 >> d8;
while true
// Call the ReadDials function passing the 8 digits by reference. ReadDials returns an error code by value.
char ReadDials(d1,d2, d3, d4, d5, d6, d7, d8);//call ReadDials
char ReadDials(char d1, char d2, char d3, char d4, char d5, char d6, char d7, char d8);
if the return value is -5, exit the do while loop
if the error code is -1, display the error message "ERROR - An invalid character was entered";
if the error code is -2, display the error message "ERROR - Phone number cannot begin with 0";
if the error code is -3, display the error message "ERROR - Phone number cannot begin with 555";
if the error code is -4, display the error message "ERROR - Hyphen is not in the correct position";
if(d1=='Q'||'q')
return -5;
// Otherwise, call the AcknowledgeCall function
End-While
return 0;
}
//ReadDials function
char ReadDials(char d1, char d2, char d3, char d4, char d5, char d6, char d7, char d8);
{
cout<<"Enter first digit."<
if a Q was entered, return -5;
cout<<"Enter the rest of the number."<
// Call the ToDigit function for each of the 7 digits, not for digit 4
if ToDigit returns -1, return -1;
if digit 4 is not a hyphen, return -4;
if digit 1 is 0, return -2;
if digits 1 - 3 are 5, return -3;
return 0
}
ToDigit function
{
// Convert the digit to upper case
switch(c)
{
case '0': cout<< result+="0"; break;
case '1': cout<< result+="1"; break;
case '2': cout<< case 'a': case 'b': case 'c': result+="2"; break;
case '3': cout<
case '4':cout<< case 'g': case 'h': case 'i': result+="4"; break;
case '5': cout<
case '6':cout<< case 'm': case 'n': case 'o': result+="6"; break;
case '7': cout<
case '8': cout<
case '9': cout<
}
if the digit is invalid, return -1;
if the digit is valid, return 0;
}
AcknowledgeCall function
{
Display the Phone Number.
}
return 0;
}
Answers: 2
Computers and Technology, 22.06.2019 11:00
You receive an email from an impressive-sounding stranger, professor alexander rothschild renard iii, president of the american institute for scientific political statesmen. he urges you to vote for his presidential candidate choice. this social media red flag is known as
Answers: 1
Computers and Technology, 22.06.2019 15:00
I'm taking a class on how to make a movie, and it offers some apps that would be in the process. the thing is, i don't have any of those ha. if you have any tips on some apps i could use, that would be awesome. i don't have an iphone, so don't suggest any apps like imovie. i know that this is a weird question, but it would be super for me. : )
Answers: 2
Computers and Technology, 22.06.2019 22:00
Consider the following declarations (1, 2, 3, 5, 7)class bagtype{public: void set(string, double, double, double, double); void print() const; string getstyle() const; double getprice() const; void get(double, double, double, double); bagtype(); bagtype(string, double, double, double, double); private: string style: double l; double w; double h; double price; }; a.) write the definition of the number function set so that private members are set according to the parametersb.) write the definition of the member function print that prints the values of the data membersc.) write the definition of the default constructor of the class bagtype so that the private member variables are initialized to "", 0.0, 0.0, 0.0, 0.0, respectively d.) write a c++ statement that prints the value of the object newbag.e.) write a c++ statement that declares the object tempbag of type bagtype, and initialize the member variables of tempbag to "backpack", 15, 8, 20 and 49.99, respectively
Answers: 3
Computers and Technology, 23.06.2019 01:00
Let r be a robotic arm with a fixed base and seven links. the last joint of r is a prismatic joint, the other ones are revolute joints. give a set of parameters that determines a placement of r. what is the dimension of the configuration space resulting from your choice of parameters?
Answers: 3
Mathematics, 06.01.2021 01:00
Mathematics, 06.01.2021 01:00
Mathematics, 06.01.2021 01:00
Mathematics, 06.01.2021 01:00
Health, 06.01.2021 01:00
Mathematics, 06.01.2021 01:00
History, 06.01.2021 01:00
Mathematics, 06.01.2021 01:00
Social Studies, 06.01.2021 01:00
Mathematics, 06.01.2021 01:00
Mathematics, 06.01.2021 01:00
Mathematics, 06.01.2021 01:00