Lab7

pdf

School

Arizona State University *

*We aren’t endorsed by this school

Course

100

Subject

Computer Science

Date

Feb 20, 2024

Type

pdf

Pages

1

Uploaded by HighnessFlamingoPerson1018

Report
CSE 100 Principles of Programming with C++ Arizona State University, ASU Online Lab 7: 10 Pts Learning objectives: After completing this lab project, the student will be able to write a menu-driven program which uses if statements, if-else statements, and nested if/else statements. . Program Specifications Create a menu-driven program that calculates and displays the areas of two different objects: squares and circles. The menu should have the following three choices: 1 -- square 2 -- circle 3 quit If the user selects choice 1, the program shall ask the user for the side length of the square (can be a decimal number) and shall calculate the area of the square and output it as shown in the sample run to the right. If the user selects choice 2, the program shall ask the user for the radius of the circle (can be a decimal number) and shall calculate the area of the circle and output it as shown in the sample run to the right. Use 3.14 for the value of pi. If the user selects choice 3, the program shall quit after outputting an additional newline. If the user enters a value for choice that is not in the range [1, 3] then the program shall output an error message as shown in the sample run to the right and will then re-display the menu. Sample Run (User input is in bold) 1 -- square 2 -- circle 3 -- quit 1 Side length of the square: 3.45 Area = 11.90 1 -- square 2 -- circle 3 -- quit 2 Radius of the circle: 17.4 Area = 951.1 1 -- square 2 -- circle 3 -- quit 7 Invalid input. Try again. 1 -- square 2 -- circle 3 -- quit 3 (The program terminates) Remember that the test cases for each lab are posted publicly on Canvas, so you can see the inputs and expected outputs that we will be using for testing and grading your programs in advance. Submit your lab7.cpp on Gradescope.
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help