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
How do you install an operating system?<br><br> Answer with full sentences
denis23 [38]

Answer:

On Windows. Insert the installation disk or flash drive. Restart your computer. Wait for the computer's first startup screen to appear. Press and hold Del or F2 to enter the BIOS page. Locate the "Boot Order" section. Select the location from which you want to start your computer.

Explanation:

6 0
3 years ago
The top-level domain name of .com indicates that the website is
Ira Lisetskai [31]
C. commercial

is ur answer
5 0
3 years ago
Read 2 more answers
Which of the following is a job description for a person with a degree in Information Technology? radiology engineer web develop
Jet001 [13]

Answer: Web developer

Explanation: Web developer is a job where you have to develop World Wide Web applications by programming or applications that run over the internet, and this degree would need a degree in information technology

The other degrees needed for the following jobs:

1.    Radiology engineer: Radiology is a study of diagnosing and treating diseases with the help of medical imaging. So, it needs a degree in medical combined with physics and chemistry.

2.    Toxicologist broadcast technician: is a job where the technician has to determine the factors which contributed to a person’s death. So, a person should have a degree in medicine to become a toxicologist technician

6 0
3 years ago
Please help meh T^T Which of the following describes an application error? Select 2 options.
Lena [83]

Answer:

"Every time you try to run your new game, it crashes after displaying the opening screen"

"After a recent Windows update, you can no longer access the internet on your laptop"

Explanation:

8 0
3 years ago
Read 2 more answers
tcp is sending data at 1 megabyte per second. if the sequence number starts with 7000, how long does it take before the sequence
aksik [14]

Data transmission using TCP is 1 MB/s. It takes [(232 1) 7000] / 1,000,000, or 4295 seconds, for the sequence number to go back to zero.

A communications protocol known as Transmission Control Protocol, or TCP, permits message transmission between computer hardware and software via a network. It is designed to transmit packets across the internet and to guarantee the successful transmission of data and messages over networks.

The Internet Engineering Task Force (IETF) has designated TCP as one of the foundational protocols that serve as the rules for the internet (IETF). One of the most extensively used protocols in digital network communications, it offers end-to-end data delivery.

Before being delivered between a server and a client, data is first structured by TCP. It guarantees the correctness of data sent through a network.

To know more about TCP click here:

brainly.com/question/28119964

#SPJ4

7 0
1 year ago
Other questions:
  • When you send an echo request message with the ping program, a successful attempt will return a(n) ______ message.
    8·1 answer
  • Businesses use a fax cover sheet is to _____. provide detailed service and product information make sure message reaches the rig
    14·2 answers
  • ____ is the use of networking technology to provide medical information and services.
    14·1 answer
  • When a compiler finds errors, it usually indicates what they are so you can correct the code and compile the program again?
    11·1 answer
  • Who ever likes Pokemon an wants to help me please comment and I will Give the room for My Assignment
    9·1 answer
  • Difference between positional and non positional number​
    12·1 answer
  • Each web site contains a(n) ____ page, which is the first document users see when they access the site.
    9·1 answer
  • Which is a potential disadvantage of emerging technologies? A. increased spread of misinformation due to advanced communication
    14·1 answer
  • A wireless ________ extender is a network device that enhances transmission of your wireless signal.
    11·1 answer
  • when inputting a formula into excel or other spreadsheet software, what components are required for the formula to function prop
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!