Create a code

Our papers are 100% unique and written following academic standards and provided requirements. Get perfect grades by consistently using our writing services. Place your order and get a quality paper today. Rely on us and be on schedule! With our help, you'll never have to worry about deadlines again. Take advantage of our current 20% discount by using the coupon code GET20


Order a Similar Paper Order a Different Paper

 

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.

  1. The area and circumference of a circle.  Prompt the user to enter the radius. Use 3.14159 for pi.
  2. The area and the perimeter of a rectangle. Prompt the user to enter the length and the width.
  • Use the plan you created last week. If need be revise your pseudocode and algorithm to match expect output and Mimir test cases. 
  • Once again desk check your pseudocode and algorithm.
  • Do not allow for invalid input.
  • Allow for positive values only.
  • Format to 3 decimal places
  • Name file main.cpp
  • To Mimir submit: .cpp file
  • Submit your pseudocode and desk check along with your code to Mimir in a separate file
  • Pseudocode and desk check should be in the format of a pdf, picture, or notepad.
  • Include your name, date at the top of the code as a comment.
  • Restate project assignment question as a comment
  • Include detailed comments throughout your code

starter.cpp

starter.cpp


 
"Geometry Calculatornn"
;


"Select a figure"
<<
endl
;


"1. Circlen"
;


 
"2. Rectanglen"
;


 
"3. Quitnn"
;


 
"Enter your choice (1-3): "
;


"The valid choices are 1 through 3. Run then"


                 
<<
 
"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 then"
 
<<
 
"program.n"
;


 

#include<iostream>
#include <iomanip>
#include<math.h>

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<<fixed<<setprecision(3);
//area or a circle =3.4=14159*radius*radius
area=3.14159*radius*radius;
cout<<“Area of Circle = “<<area<<endl;
break;
}
case 2:
{
cout<<“nEnter the Length and Breadth of Rectangle:”;
cin>>length>>width;
cout<<fixed<<setprecision(3);
// area of the rectangle = length * width
area=length*width;
cout<<“Area of Rectangle = “<<area<<endl;
break;
}
case 3:
{
cout<<“nEnter the Radius of Circle: “;
cin>>radius;
cout<<fixed<<setprecision(3);
// circumfernce of a circle= 2(3.14159*adius)
circumference = 2*3.14159*radius;
cout<<“circumference of Circle = “<<circumference<<endl;
break;
}
case 4:
{
cout<<“nEnter the Lengt and Width of Rectangle:”;
cin>>length;
cin>>width;
cout<<fixed<<setprecision(3);
//perimeter of rectangle=2(length +width)
perimeter= 2*(length+width);
cout<<“perimeter of Rectangle = “<<perimeter<<endl;
break;
default: cout<<“n Invalid Choice Try Again…!!!”;
break;
}
return 0;
}
}

Desk Check for selecting a figure
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

Writerbay.net

We offer the best essay writing services to students who value great quality at a fair price. Let us exceed your expectations if you need help with this or a different assignment. Get your paper completed by a writing expert today. Nice to meet you! Want 15% OFF your first order? Use Promo Code: FIRST15. Place your order in a few easy steps. It will take you less than 5 minutes. Click one of the buttons below.


Order a Similar Paper Order a Different Paper