Pt1420 Unit 5 Assignment 1
1. Explain what is meant by the term “conditionally executed”. Conditionally executed is called a single alternative decision structure because it provides only one alternative path of execution. The action is conditionally executed because it is performed only when a certain condition is true.
2. You need to test a condition and then execute one set of statements if the condition is true. If the condition is false, you need to execute a different set of statements. What structure will you use?
I will use the “If” statement because it is a dual alternative decision structure.
3. If you need to a test the value of a variable and use that value to determine which statement or set of statements to execute, which …show more content…
Design a program that prompts the user to enter a number within the range of 1 through 10. The program should display the Roman numeral version of that number. If the number is outside the range of 1 through 10, the program should display an error message.
Main Mod Declare Integer
2. Areas of Rectangles
The area of a rectangle is the rectangle’s length times its width. Design a program that asks for the length and width of two rectangles. The program should tell the user which rectangle has the greater area, or if the areas are the same.
Main Module Declare length1 as integer, length2 as Integer, width1 as integer,width2 as integer Declare AreaOfFirstRectangle as integer, AreaOfSecondRectangle as integer
Display "Enter length of first rectangle" Input length1 Display "Enter width of first rectangle" Input width1
AreaOfFirstRectangle =length1 * width1