In: Computer Science
Area and Circumference -- FLOWGORITHM
------
You are going to update assignment 2 which was Area and Circumference (see below). This time the user will have the ability convert Area of Circle or the Circumference of Circle. Don’t forget all of the below requirements still apply, so if you didn’t fix or update assignment 2, you’d better get it done.
Assignment 2
In this assignment you are to develop the modules (i.e. functions or procedures). You are going to calculate the Area of Circle and the Circumference of Circle. There will be 4 modules to create. So, calculate the Area of Circle first then do the Circumference of Circle. You will have to research and decide which modules need to be a subroutine and which need to be a function.
Requirements:
The user will enter the information when the program is executing
1st convert the Area of Circle
2nd convert the Circumference of Circle
5 total module, 4 modules to create
One for input
One calculating Area
One for calculating Circumference
One for output
And you are still required to use the main(), which runs everything
No decision structures or loops
With correct answer and the number entered will be displayed. Information will need to be passed in so the correct output will be displayed
Required use Flowgorithm, then submit it for a grade.
The formulas are:
Area of Circle: area = π * r²
Calculates specifically the total area within a circle.
For example: radius = 4
a = π x 4²
a = π x 16
a = 50.24
Circumference of Circle: circumference = 2π * r
Calculates specifically the length of the outline of a circle.
For example: radius = 7
c = 2π x 7
c = 43.98
Answer: Hey!! Kindly finds your solution below. Let me know if any issue. Thanks.
Pseusocode: This code has 5 modules including main. input(),output(),areaOfCircle(),circumOfCircle(). In main, all functions called to get proper result as you shown in your problem.
if any issue asks in the comment box.
Module main()
Declare Real r, area, cir
Set r = 1
Set r = input_function(r)
Set area = areaOfCircle(r)
Set r = input_function(r)
Set cir = circumOfCircle(r)
Call output(area, cir)
End Module
Function Real
areaOfCircle(Real radius)
Declare Real area
Set area = 3.14 * radius * radius
Return area
End Function
Function Real
circumOfCircle(Real radius)
Declare Real circum
Set circum = 2 * 3.14 * radius
Return circum
End Function
Function Real
input_function(Real radius)
Display "Enter radius of circle: "
Input radius
Return radius
End Function
Module output(Real a, Real
c)
Display "Area of Circle: ", a
Display "Circumference of Circle: ", c
End Module
Flowchart: