Question: 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++ please slove these in c++ Assignment 3.1 [15 points] Write aninteractive program that computes the area of a square (area side2) ortriangle (area 1/2* base height) after prompting the user to type thefirst character of the figure name (t or s). Make sure that

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!