Create a program that will compute:
First submit the psuedo code and desk check
Second submit .cpp file, the code
You may resubmit you code if you had to fixe your code to pass the test cases.
starter.cpp
starter.cpp
“Geometry Calculator\n\n”
;
“Select a figure”
<<
endl
;
"1. Circle\n"
;
"2. Rectangle\n"
;
"3. Quit\n\n"
;
"Enter your choice (1-3): "
;
"The valid choices are 1 through 3. Run the\n"
<<
"program again.\n"
;
"\nEnter the circle's radius: "
;
"\nThe radius must be greater than zero.\n"
;
"Enter 1 for area or 2 for circumference: "
;
"\nThe area is "
<<
your code
<<
endl
;
}
"Circumference"
<<
endl
;
"\nThe circumference is "
<<
your code
<<
endl
;
"Invalid selection"
<<
endl
;
"\nEnter the rectangle's length: "
;
"Enter the rectangle's width: "
;
"\nOnly enter positive values for "
<<
"length and width.\n"
;
"Enter 1 for area or 2 for perimeter"
<<
endl
;
"Area"
<<
endl
;
"\nThe area is "
<<
your code
<<
endl
;
"Perimeter"
<<
endl
;
"\nThe perimeter is "
<<
your code
<<
endl
;
"Invalid selection"
<<
endl
;
"Program ending.\n"
;
"The valid choices are 1 through 3. Run the\n"
<<
"program.\n"
;
#include Desk Check for selecting a figure
#include
#include
using namespace std;
int main()
{
float length, width,circumference,perimeter, radius, area;
int ch;
cout<<"1.Area Of Circle";
cout<<"\n2.Area Of Rectangle";
cout<<"\n3.Circumference Of Circle";
cout<<"\n4.Perimeter Of Rectangle";
cout<<"\nEnter Your Choice :";
cin>>ch;
switch(ch)
{
case 1:
{
cout<<"\nEnter the Radius of Circle: ";
cin>>radius;
cout<
cout<
cout<
cin>>width;
cout<
Ask user to select a figure (1. Circle, 2. Rectangle, 3. Quit)
User selects 1
Follow code for Area and Circumference of Circle
User selects 2
Follow code for Area and Perimeter of Rectangle
User selects 3
End the execution of the code
Selects any other value
Output: Invalid selection
Desk Check for Area of a circle;
Ask user to input r
User inputs: -10
Display: You entered radius as: -10
Display: You input Invalid value
Ask user to input r
User inputs: 10
Display: You entered radius as: 10
Display: Area of Circle is: 314.000
Desk Check for Circumference of a Circle;
Ask user to input r
User inputs: -10
Display: You entered radius as: -10
Display: You input Invalid value
Ask user to input r
User inputs: 10
Display: You entered radius as: 10
Display: Circumference of Circle is: 62.832
Desk Check for Area and Perimeter of Rectangle;
User selects a Rectangle
Ask user to input length
User inputs: -5
Output: You entered l as: -5
Press enter on the keyboard
Output: You entered Invalid value
Ask user to input length
User inputs: 5
Output: You entered l as: 5
Ask user to input width
User inputs: -4
Press enter on the keyboard
Output: You entered w as: -4
Output: You entered Invalid value
Ask user to input width
User inputs 4
Press enter on the keyboard
Display: You entered w as: 4
Display: Area of Rectangle is: 20.000
Display: Perimeter of Rectangle is: 18.000