Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Cannot use break, continue or goto. we use #include using namespace std; format. thank you. 1 / 2 90% + 10 CS 161 Programming Lab

Cannot use break, continue or goto.
we use #include
using namespace std; format. thank you. image text in transcribed
image text in transcribed
1 / 2 90% + 10 CS 161 Programming Lab 7 Problem Description For this assignment, you are to compute the areas of four different geometric shapes: circle, square, rectangle, and triangle. For circle, square, and rectangle, you will also compute the perimeter. While this program requires the use of reference parameters, it will also be a review of functions, data validation, selection, and loops. Your functions should be split into function prototypes or declarations in a header file and function definitions in a code or source file. As part of the development process, you will need to write stubs for each of your functions to test that main works properly. The stubs should simply output their parameters. Note, in the final lab, the functions should not do any output, they should just do a calculation For this as in all assignments, you are expected to follow the course programming style guidelines. Program Functionality In main, the user will be asked to enter a character to choose which shape they want, c for circles for square,r for rectangle, t for triangle, and e for end. Define constants for these characters. Display clear instructions to the user Input a character code for a shape, either upper or lower case Select the proper function based on the code C-circle, get radius, call circle function, display area & circumference E-end program R- rectangle, get length & width, call rectangle function, display area & perimeter S-square, get side, call square function, display area & perimeter T-triangle, get length & width, call triangle function, display area invalid Input, output an error message Continue looping until the user has entered for end Use floating point values for all numbers. Pl should be a constant equal to 3.14159 Required Functions At a minimum the program should have the following functions: RetNumber Kets a valid positive floating point number returns the value . . o O O . o Required Functions At a minimum the program should have the following functions: getNumber o gets a valid positive floating point number returns the value o circle o input is the radius o calculates area (PP*r*r) and circumference (2*Plr) o passes back area and circumference via reference This work by Jim Bailey is licensed under a Creative Commons Attribution 4.0 International License. O rectangle o input is length and width o calculates the area (length*width) and perimeter(2*(length+width)) passes back area and perimeter via reference square o input is length and width o calculates the area (length*width) and perimeter(2*(length+width)) passes back area and perimeter via reference triangle o input is length and width calculates the area (length*width/2) returns area via return O O The function getNumber is used to get all input numbers. Your main program will get all input and display all output. Make sure that all parameters and return values are the correct types

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

Step: 3

blur-text-image

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

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions

Question

What is meant by Career Planning and development ?

Answered: 1 week ago

Question

What are Fringe Benefits ? List out some.

Answered: 1 week ago