1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Fudgin [204]
3 years ago
7

You are required to write a calculator for Geometric shapes(Circle, Square, and Rectangle). The basic idea is that you willprovi

de the information regarding a geometric shape and yourprogram will calculate the area, circumference and perimeter.
Computers and Technology
1 answer:
denis23 [38]3 years ago
4 0

Answer: The c++ program to calculate area and perimeter for different geometric shapes is given below.

#include <iostream>

using namespace std;

void circle();

void square();

void rectangle();

int main() {  

string shape;

char choice;  

do

{

cout<<"Enter the geometrical shape (circle, square, rectangle)." <<endl;

cin>>shape;  

if(shape == "circle")

       circle();        

   if(shape == "square")

       square();        

   if(shape == "rectangle")

       rectangle();        

   cout<<"Do you wish to continue (y/n)"<<endl;

   cin>>choice;    

   if(choice == 'n')

       cout<<"quitting..."<<endl;        

}while(choice != 'n');

return 0;

}

void circle()

{

   float area, circumference;

   float r, pi=3.14;    

   cout<<"Enter the radius of the circle"<<endl;

   cin>>r;    

   circumference = 2*pi*r;

   area = pi*r*r;    

   cout<<"The circumference is "<<circumference<<" and the area of the circle is "<<area<<endl;    

}

void square()

{

   float area, perimeter;

   float s;    

   cout<<"Enter the side of the square"<<endl;

   cin>>s;    

   perimeter = 4*s;

   area = s*s;    

   cout<<"The perimeter is "<<perimeter<< " and the area of the square is "<<area<<endl;

}

void rectangle()

{

   float area, perimeter;

   float b, h;    

   cout<<"Enter the breadth of the rectangle"<<endl;

   cin>>b;    

   cout<<"Enter the height of the rectangle"<<endl;

   cin>>h;    

   perimeter = 2*(b+h);

   area = b*h;    

   cout<<"The perimeter is "<<perimeter<< " and the area of the rectangle is "<<area<<endl;

}

 

OUTPUT

Enter the geometrical shape (circle, square, rectangle).

circle

Enter the radius of the circle

3.56

The circumference is 22.3568 and the area of the circle is 39.7951

Do you wish to continue (y/n)

n

quitting...

Explanation:

The program performs for circle, square and rectangle.

A method is defined for every shape. Their respective method contains the logic for user input, computation and output.

Every method consists of the variables needed to store the dimensions entered by the user. All the variables are declared as float to ease the computation as the user can input decimal values also.

No parameters are taken in any of the methods since input is taken in the method itself.

You might be interested in
CREIDT INAOCT Unscramble thr word<br>please solve it fast its urgent ​
ivanzaharov [21]

Answer:

Credit Action .......I believe

6 0
2 years ago
IT professionals should help to protect users’ personal information, such as bank account information or Social Security numbers
sesenic [268]

To prevent theft of account information, identity theft, money, important passwords, and personal information.


Hope it helps ❤️

8 0
3 years ago
Read 2 more answers
A _______ is a particular type of report that is made up of strategic objectives and metrics to help the organization reach its
Reika [66]

Answer:

A balanced score card is a particular type of report that is made up of strategic objectives and metrics to help the organization reach its target measures in line with strategic goals

Explanation:

A balanced scorecard is a framework for strategic planning and performance , which be presented in the form of a report.It clearly outlines organizational goals into measurable quantities such as time, quality of service or product, performance and cost. With a balanced scorecard, the organization can set a strategy and measure it and then effectively monitor and track the progress and results of the strategy.

5 0
3 years ago
Which is not a category of business or industry covered under OSHA standards? A. Construction B. General Industry C. Maritime D.
cestrela7 [59]
The answer from the given option is "D", "<span>OSHA covers all categories of business and industry".


OSHA stands for </span>Occupational Safety and Health Administration, which is an agency of the United States Department of Labor. The four categories of business and industry that are covered by the standards are general industry, maritime, construction and agriculture. So the the answer from the given options is D, because a, b and c are included in the categories.
5 0
2 years ago
Printed versions of your presentation that contain the slides and blank lines below are called
m_a_m_a [10]

Answer:

Handouts

Explanation:

matches description

6 0
1 year ago
Other questions:
  • Build three classes that conform to the following interfaces. Use arrays in creating your classes (e.g., do not use the built-in
    8·1 answer
  • _______________ is used by a hacker to mask intrusion and obtain administrator permissions to a computer.
    7·1 answer
  • List three types of cardinalities for relationships within a relational database.
    9·1 answer
  • "the magical number seven, plus or minus two" refers to the storage capacity of ________ memory.
    5·2 answers
  • Stamps offers at-home postage and mailing for a monthly fee. Customers are able to carry a balance on their accounts that allows
    7·1 answer
  • ____ is the process of drawing a series of increasingly detailed DFDs, until all functional primitives are identified.
    7·1 answer
  • Data is best described as
    10·2 answers
  • Write down the stages in the information prcessing cycle in correct order​
    5·1 answer
  • Online education students need to be taught ______. Select 2 options.
    12·1 answer
  • Enabling encryption of all data on a desktop or laptop computer is generally considered:______.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!