1. Write a program to let the user choose from the following list and solve for the solution. Write the codes inside the box SAMPLE OUTPUT 1. Area 1. AREA OF RECTANGLE - Area of rectangle = length x width 2. AREA OF CIRCLE - Area of Circle = 3.1416* (radius * radius) Welcome!. Choose what you want to solve 1. Area 2. Perimeter 2 Choose from the following 1. Perimeter of the Rectangle 2. Perimeter of the Circle 3. AREA OF SQUARE - Area of Square = side * side AREA OF TRIANGLE - Area of Triangle = (height * base)/2 %3D 4. 2. Perimeter 1 DERIMETER OF PECTANGLE. Derimeter of rectangle

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

What is the pseudocode for this?

Below is the C++

 

#include <iostream>

 

using namespace std;

 

int main ()

 

{

int first_opt, area_opt, perimeter_opt, length, width, radius, side, height, base, a, b, c, A_Rect, A_Square, P_Rect, P_Square, P_Triangle;

 

float A_Circle, A_Triangle, P_Circle;

 

 

 

cout<<"Welcome!. Choose what you want to solve"<<"\n";

 

cout<<"1. AREA"<<"\n";

cout<<"2. PERIMETER"<<"\n";

 

cin>>first_opt;

 

cout<<"Choose from the following"<<"\n";

 

switch(first_opt)

{

case 1:

 

cout<<"1. Area of the Rectangle"<<"\n";

cout<<"2. Area of the Circle"<<"\n";

cout<<"3. Area of the Square"<<"\n";

cout<<"4. Area of the Triangle"<<"\n";

cin>>area_opt;

 

 switch(area_opt)

 {

 case 1:

 cout<<"Enter length: "<<"\n";

 cin>>length;

 cout<<"Enter width: "<<"\n";

 cin>>width;

 A_Rect = length*width;

 cout<<"The area of the rectangle is: "<<A_Rect<<"\n";

 

 case 2:

 cout<<"Enter radius: "<<"\n";

 cin>>radius;

 A_Circle = 3.1416*radius*radius;

 cout<<"The area of the circle is: "<<A_Circle<<"\n";

 

 case 3:

 cout<<"Enter side: "<<"\n";

 cin>>side;

 A_Square = side*side;

 cout<<"The area of the square is: "<<A_Square<<"\n";

 

 case 4:

 cout<<"Enter height: "<<"\n";

 cin>>height;

 cout<<"Enter base: "<<"\n";

 cin>>base;

 A_Triangle = (height*base)/2;

 cout<<"The area of the triangle is: "<<A_Triangle<<"\n";

 

 default:

 cout<<"out of options";

 break;

 }

break;

 

case 2:

 

cout<<"1. Perimeter of the Rectangle"<<"\n";

cout<<"2. Perimeter of the Circle"<<"\n";

cout<<"3. Perimeter of the Square"<<"\n";

cout<<"4. Perimeter of the Triangle"<<"\n";

cin>>perimeter_opt;

 

 switch(perimeter_opt)

 {

 case 1:

 cout<<"Enter length: "<<"\n";

 cin>>length;

 cout<<"Enter width: "<<"\n";

 cin>>width;

 P_Rect = 2*(length+width);

 cout<<"The perimeter of the rectangle is: "<<P_Rect<<"\n";

 

 case 2:

 cout<<"Enter radius: "<<"\n";

 cin>>radius;

 P_Circle = 3.1416*radius*2;

 cout<<"The perimeter of the circle is: "<<P_Circle<<"\n";

 

 case 3:

 cout<<"Enter side: "<<"\n";

 cin>>side;

 P_Square = 4*side;

 cout<<"The perimeter of the square is: "<<P_Square<<"\n";

 

 case 4:

 cout<<"Enter the length of first side: "<<"\n";

 cin>>a;

 cout<<"Enter the length of second side: "<<"\n";

 cin>>b;

 cout<<"Enter the length of third side: "<<"\n";

 cin>>c;

 

 P_Triangle = a+b+c;

 cout<<"The area of the triangle is: "<<P_Triangle<<"\n";

 

 default:

 cout<<"out of options";

 break;

}

break;

 

default:

cout<<"out of options";

break;

 

 

}

 

return 0;

 

}

 

1. Write a program to let the user choose from the following list and solve for the solution. Write
the codes inside the box
SAMPLE OUTPUT
1. Area
1. AREA OF RECTANGLE - Area of rectangle = length x width
2. AREA OF CIRCLE - Area of Circle = 3.1416* (radius * radius)
Welcome!. Choose what you want to solve
1. Area
2. Perimeter
2
Choose from the following
1. Perimeter of the Rectangle
2. Perimeter of the Circle
3. Perimeter of the Square
4. Perimeter of the Rectange
3
PERIMETER OF THE SQUARE
Enter side: 2
The perimeter of the square is: 8
3. AREA OF SQUARE - Area of Square = side * side
4. AREA OF TRIANGLE - Area of Triangle = (height * base)/2
2. Perimeter
1. PERIMETER OF RECTANGLE - Perimeter of rectangle =
2*(length + width)
2. PERIMETER OF CIRCLE - Perimeter of Circle =
2*3.1416*radius
3. PERIMETER OF SQUARE - Perimeter of Square = 4 * side
4. PERIMETER OF TRIANGLE - Perimeter of Triangle = a+b+c
Transcribed Image Text:1. Write a program to let the user choose from the following list and solve for the solution. Write the codes inside the box SAMPLE OUTPUT 1. Area 1. AREA OF RECTANGLE - Area of rectangle = length x width 2. AREA OF CIRCLE - Area of Circle = 3.1416* (radius * radius) Welcome!. Choose what you want to solve 1. Area 2. Perimeter 2 Choose from the following 1. Perimeter of the Rectangle 2. Perimeter of the Circle 3. Perimeter of the Square 4. Perimeter of the Rectange 3 PERIMETER OF THE SQUARE Enter side: 2 The perimeter of the square is: 8 3. AREA OF SQUARE - Area of Square = side * side 4. AREA OF TRIANGLE - Area of Triangle = (height * base)/2 2. Perimeter 1. PERIMETER OF RECTANGLE - Perimeter of rectangle = 2*(length + width) 2. PERIMETER OF CIRCLE - Perimeter of Circle = 2*3.1416*radius 3. PERIMETER OF SQUARE - Perimeter of Square = 4 * side 4. PERIMETER OF TRIANGLE - Perimeter of Triangle = a+b+c
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY