Question

Write an IF-THEN-ELSE statement in pseudo code that tests whether variable Shape contains the value “T”...

Write an IF-THEN-ELSE statement in pseudo code that tests whether variable Shape contains the value “T” (for triangle) or the value “S” (for square). It then tells the user what the shape is and the number of sides the shape has.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

READ SHAPE
IF SHAPE =="T" THEN
   PRINT "SHAPE IS TRIANGLE AND IT HAS 3 SIDES"
ELSE IF SHAPE=="S" THEN
   PRINT "SHAPE IS SQUARE AND IT HAS 4 SIDES"

  
END IF

Add a comment
Know the answer?
Add Answer to:
Write an IF-THEN-ELSE statement in pseudo code that tests whether variable Shape contains the value “T”...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need this in Net beans and not Python. Part 1 - Pseudo-code Design and write...

    I need this in Net beans and not Python. Part 1 - Pseudo-code Design and write the pseudo-code for the following Problem Statement. Problem Statement A company gives its employees an that will provide one of 3 results based on the following ranges of scores: Score Message on Report 90-100 Special Commendation 70-89 Pass Below 70 Fail Design a single If-Then-Else structure using pseudo-code which displays one of these messages based a score input by a user. Be sure your...

  • Write a Java program that prompts the user to enter a number representing a geometric shape....

    Write a Java program that prompts the user to enter a number representing a geometric shape. Options are 1 for square, 2 for rectangle, and 3 for right triangle. According to the user input, the program will collect either 1, 2 or 3 values from the user representing the lengths of the shape sides. The user is responsible for ensuring the 3 sides of the triangle represent a right triangle. The program will print the perimeter of the shape. Use...

  • Q.5. (a) Write a program/ pseudo-code with following specs. The program contains an integer variable x...

    Q.5. (a) Write a program/ pseudo-code with following specs. The program contains an integer variable x initialized with value 20. After initializing x the program creates 07 processes using fork(). Each parent adds 10 to x and prints x. (15)

  • Python Write if/else code that adds one to the variable adults if the value of age...

    Python Write if/else code that adds one to the variable adults if the value of age is greater or equal to 18, and adds one to the variable minors otherwise.

  • EXERCISES: if & if...else STATEMENTS: Name Examples of if and if-else statements: Write an if statement...

    EXERCISES: if & if...else STATEMENTS: Name Examples of if and if-else statements: Write an if statement that multiplies payRate by 1.5 iſ hours is greater than 40. Write variable declarations for the variables payRate and hours first. Hint: Look for keyword if first, your boolean comes after the keyword [. This translates into Java as: double hours, payRate; if (hours > 40) { //{-} are optional here but I recommend that you them payRate = payRate 1.5; pay Rato pay...

  • Write a Java program that prompts user to select one of the five shapes(Rectangle, Square, Triangle,...

    Write a Java program that prompts user to select one of the five shapes(Rectangle, Square, Triangle, Circle, and Parallelogram), then calculate area of the shape,must have input validation and uses more of java library like math class, wrapper class, string methods, use formatted output with the printf method. Finally, create a pseudo-code statement and flowchart

  • Topics If/Else statement Description    Write a program that determines the larger of the two numbers...

    Topics If/Else statement Description    Write a program that determines the larger of the two numbers provided by the user. The program asks the user to enter a number. Then it asks the user to enter another but a different number. Then, it determines the larger of the two numbers and displays it to the user. (If the user happens to enter the two numbers the same, the program may report either of the two numbers as larger.) Requirements Do...

  • Write a pseudo-code method isInL(s) that uses a stack to determine whether a string s is...

    Write a pseudo-code method isInL(s) that uses a stack to determine whether a string s is in language L, where L = {w: w is of the form A^nB^n for some n >= 0}

  • Write a program that reads a string from the keyboard and tests whether it contains a...

    Write a program that reads a string from the keyboard and tests whether it contains a valid time. Display the time as described below if it is valid, otherwise display a message as described below. The input date should have the format hh:mm:ss (where hh = hour, mm = minutes and ss = seconds in a 24 hour clock, for example 23:47:55). Here are the input errors (exceptions) that your program should detect and deal with: Receive the input from...

  • Write a program that reads a string from keyboard and tests whether it contains a valid...

    Write a program that reads a string from keyboard and tests whether it contains a valid date. Display the date and a message that indicates whether it is valid. If it is not valid, also display a message explaining why it is not valid. The input date will have the format mm/dd/yyyy. A valid month value mm must be from 1 to 12 (January is 1). The day value dd must be 1 from to a value that is appropriate...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT