Write algorithms and draw flowcharts for the following: Accept the length of side of a square and calculate their area and perimeter. Display the message accordingly.[6]
Question
Write algorithms and draw flowcharts for the following: Accept the length of side of a square and calculate their area and perimeter. Display the message accordingly.[6]
Solution
Algorithm:
Step 1: Start Step 2: Declare variables side, area, perimeter. Step 3: Read the value of side. Step 4: Calculate area by multiplying side by side (area = side * side). Step 5: Calculate perimeter by multiplying side by 4 (perimeter = 4 * side). Step 6: Display area and perimeter. Step 7: Stop
Flowchart:
- Start
- Declare variables (side, area, perimeter)
- Input side
- Calculate area (area = side * side)
- Calculate perimeter (perimeter = 4 * side)
- Output area and perimeter
- Stop
Please note that I can't draw a flowchart here, but the steps above describe the process in a flowchart manner.
Similar Questions
Actual instructions in flowchart are represented in________a) Circle b) Boxes c) Arrows d) Lines e) Diamond f) None
he flowchart symbol for a decision isGroup of answer choicesA rectangleA diamondA parallelogramAn oval
e the following flowchart to answer the below two questions 1) and 2).
Write an algorithm and draw a flowchart to calculate SimpleInterest.
Write a Java program using " static" that utilizes your ShapeUtility class to demonstrate the calculation of area and perimeter for a circle and a rectangle. Display the total number of shapes processed at the end.The ShapeUtility class to calculate the area and perimeter of a circle and a rectangle. The totalShapes variable (static) in the ShapeUtility class should be used to keep track of the total number of shapes processed, then display the results and the total number of shapes processed at the end ( as per the Output Format).Input Format:The first line contains the radius of a circle (a double variable)The second line contains the length of a rectangle (a double variable)The third line contains the breadth of a rectangle (a double variable) Output Format:First line contains the area of a circle (a float : restrict to two precisions)Next line contains the perimeter of a circle (a float : restrict to two precisions)Next line contains the area of a rectangle (a float : restrict to two precisions)Next line contains the perimeter of a rectangle (a float : restrict to two precisions)Last line contains the total number of shapesprocesed. Testcase-1:Input:1.12.23.3Output:3.806.917.2611.004 Testcase-2:Input:1.23.54.2Output:4.527.5414.7015.404
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.