Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please slove these in c++ Assignment 3.1 [15 points] Write an interactive program that computes the area of a square (area side2) or triangle (area

please slove these in c++image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Assignment 3.1 [15 points] Write an interactive program that computes the area of a square (area side2) or triangle (area 1/2* base height) after prompting the user to type the first character of the figure name (t or s). Make sure that your output matches the sample output exactly. Note that a square does not have a base and a height. It has only a side. Your variable names should reflect this. Use double variables so that the user can enter a decimal if desired. Round your answer to the nearest tenth. Hint: in order to round the numbers to the nearest tenth, #include at the top of your program and use something like This will cause your output to be rounded to 1 digit after the decimal. In this program it will be best to NOT use any named constants. Sample screen output 1: Enter the type of figure (s or t):t Enter the base: 7 Enter the height: 3 The area is 10.5 Sample screen output 2: Enter the type of figure (s or t): s Enter the length of a side: 9 The area is 81.0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

Express the given angles to the nearest minute. 749.75

Answered: 1 week ago

Question

identify the main types of research studies in HRM research;

Answered: 1 week ago

Question

=+1 Why are local employment laws important to IHRM?

Answered: 1 week ago

Question

=+ Are some laws more important than others? If so, which ones?

Answered: 1 week ago