Question

In: Computer Science

I NEED THIS IN PSEUDOCODE: SWITCH/CASE 2 - Complete the pseudocode below by including a SWITCH...

I NEED THIS IN PSEUDOCODE:

SWITCH/CASE 2 - Complete the pseudocode below by including a SWITCH statement that takes the user input (an integer between 26-30) and prints out a count up in its English equivalent. For example: if the user inputs “26”, the code will print “twenty-six”, “twenty-seven” on the next line, and so on up to “thirty”. If the user inputs “30”, the code will print “thirty” and finish.

CREATE inputNum

PRINT ("Please enter a number between 26-30 to start counting from:")

READ inputNum

WHILE inputNum >= 26 AND inputNum <= 30

BEGIN WHILE

Solutions

Expert Solution

Answer :

CREATE inputNum

PRINT ("Please enter a number between 26-30 to start counting from :")

READ inputNum

WHILE inputNum >=26 AND inputNum <=30

BEGIN WHILE

SWITCH STATEMENT

CASE based on inputNum

      CASE 26:
      PRINT("twenty-six")
      PRINT("\ntwenty-seven")
      PRINT("\ntwenty-eight")
      PRINT("\ntwenty-nine")
      PRINT("\nthirty")
    
      BREAK

      CASE 27:
      PRINT("twenty-seven")
      PRINT("\ntwenty-eight")
      PRINT("\ntwenty-nine")
      PRINT("\nthirty")
    
      BREAK

      CASE 28:
      PRINT("twenty-eight")
      PRINT("\ntwenty-nine")
      PRINT("\nthirty")
    
      BREAK;

      CASE 29:
      PRINT("twenty-nine")
      PRINT("\nthirty")
          
      BREAK;

      CASE 30:
      PRINT("thirty")
          
      BREAK

END SWITCH STATEMENT

END WHILE

Converting pseudo code into c program :

#include <stdio.h>

int main(void)

{

int inputNum;

printf("Please enter a number between 26-30 to start counting from :");

scanf("%d",&inputNum);

while(inputNum >=26 && inputNum <= 30)

{

switch(inputNum)

{

case 26:

printf("twenty-six");

printf("\ntwenty-seven");

printf("\ntwenty-eight");

printf("\ntwenty-nine");

printf("\nthirty");

break;

case 27:

printf("twenty-seven");

printf("\ntwenty-eight");

printf("\ntwenty-nine");

printf("\nthirty");

break;

case 28:

printf("twenty-eight");

printf("\ntwenty-nine");

printf("\nthirty");

break;

case 29:

printf("twenty-nine");

printf("\nthirty");

break;

case 30:

printf("thirty");

break;

}

break;

}

return 0;

}

Output :


Related Solutions

REQUIREMENT 2, 5 & 9 Okay, I have a case study I need to complete by...
REQUIREMENT 2, 5 & 9 Okay, I have a case study I need to complete by the end of this week but I am stuck. Plus, I need to make sure that I am doing this correctly. It is a layered challenge. I will have to send the study in pieces because I could not attach the actual document.    This Sheet will be used for Requirements 2, 5, and 9.                              Requirement #2:      ...
Okay, I have a case study I need to complete by the end of this week...
Okay, I have a case study I need to complete by the end of this week but I am stuck. Plus, I need to make sure that I am doing this correctly. It is a layered challenge. I will have to send the study in pieces because I could not attach the actual document.    Requirement #1:                                               During its first month of operation, the Quick Tax Corporation, which specializes in...
I need this in C# with pseudocode Exercise #2: Design and implement a programming (name it...
I need this in C# with pseudocode Exercise #2: Design and implement a programming (name it EvenOdd) that uses a while loop to determine and print out all even numbers between 50 and 100 on a single line, separated by commas. Then another while loop in the same program to print out all odd numbers between 50 and 100 on a new line, separated by commas. Document your code and properly label the outputs as shown below. Even numbers between...
REQUIREMENT #3 Okay, I have a case study I need to complete by the end of...
REQUIREMENT #3 Okay, I have a case study I need to complete by the end of this week but I am stuck. Plus, I need to make sure that I am doing this correctly. It is a layered challenge. I will have to send the study in pieces because I could not attach the actual document.    Prepare a trial balance for July.     During its first month of operation, the Quick Tax Corporation, which specializes in tax preparation,              ...
REQUIREMENT #8 Okay, I have a case study I need to complete by the end of...
REQUIREMENT #8 Okay, I have a case study I need to complete by the end of this week but I am stuck. Plus, I need to make sure that I am doing this correctly. It is a layered challenge. I will have to send the study in pieces because I could not attach the actual document.    Requirement #8:                                              Prepare the closing entries at July 31 in the General Journal...
REQUIREMENT #10 Okay, I have a case study I need to complete by the end of...
REQUIREMENT #10 Okay, I have a case study I need to complete by the end of this week but I am stuck. Plus, I need to make sure that I am doing this correctly. It is a layered challenge. I will have to send the study in pieces because I could not attach the actual document.    Requirement #10:                                              Prepare a post-closing trial balance as of July 31 in the...
Hello, I need some advice on the case below. I need to know some arguments for...
Hello, I need some advice on the case below. I need to know some arguments for how Kant's ethics applies to this case, and why other people who believe in the Kantean theory of ethics would also support the arguments. I need to use Kants theory to determine if this is morally correct or incorrect. Casino Gambling on Wall Street Case 4.5 Casino Gambling on Wall Street CDO stands for “ collateralized debt obligation,” and before the financial meltdown of...
Hello, I need some assistance on completing this program in Pseudocode and in C++ Program 2:...
Hello, I need some assistance on completing this program in Pseudocode and in C++ Program 2: Buh-RING IT! For this assignment, you’re going to simulate a text-based Role-Playing Game (RPG). Design (pseudocode) and implement (source) for a program that reads in 1) the hero’s Hit Points (HP – or health), 2) the maximum damage the hero does per attack, 3) the monster’s HP and 4) the maximum monster’s damage per attack. When the player attacks, it will pick a random...
Discuss the purpose of a switch below:    1. Benefits of using a switch    2....
Discuss the purpose of a switch below:    1. Benefits of using a switch    2. Types of switches    3. How is a switch used in a network infrastructure
I have a case study and I need some ideas please. below is a summary. I...
I have a case study and I need some ideas please. below is a summary. I needs ideas regarding management of cost accounting In a company X, the expenses in human ressources are taking 60% of the revenue, so the profit is being considerably reduced. as a cost accountant, what strategies or tactics can be implemented in order to manage better or minize this cost and increase profit. PLEASE i NEED ideas in order to keep moving with this case...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT