{"id":5399,"date":"2023-02-26T16:10:58","date_gmt":"2023-02-26T16:10:58","guid":{"rendered":"https:\/\/www.goodacademic.com\/blog\/questions\/ch-4-program-2-geometry-calculator\/"},"modified":"2023-02-26T16:10:58","modified_gmt":"2023-02-26T16:10:58","slug":"ch-4-program-2-geometry-calculator","status":"publish","type":"questions","link":"https:\/\/www.goodacademic.com\/blog\/questions\/ch-4-program-2-geometry-calculator\/","title":{"rendered":"Ch 4 Program 2: Geometry  Calculator"},"content":{"rendered":"<div class=\"col-sm-12 messageContent\">\n <b>Learning Goal: <\/b>I&#8217;m working on a c++ project and need the explanation and answer to help me learn.<\/p>\n<p>Ch 4 Program 2 \u00e2\u20ac\u201c GeometryCalculator<\/p>\n<p>Please adhere to the Standards for Programming Assignments and the C++ Coding Guideline.<\/p>\n<p>Submit the following:<\/p>\n<p>\u00ef\u201a\u00b7 List of source code with comments to document<\/p>\n<p>\u00ef\u201a\u00b7 Test output listed as comments at the end of your program<\/p>\n<p>GeometryCalculator.cpp (15 pts)<\/p>\n<p>Write a program that displays the following menu:<\/p>\n<p>1. Calculate the area of a circle<\/p>\n<p>2. Calculate the area of a rectangle<\/p>\n<p>3. Calculate the area of a triangle<\/p>\n<p>4. Quit<\/p>\n<p>Prompt the user to enter a menu choice.<\/p>\n<p>Then based on the user\u00e2\u20ac\u2122s choice use a switch statement to do the following:<\/p>\n<p>\u00ef\u201a\u00b7 If the user enters 1, then you should prompt for the radius of the circle and display its area. Use<\/p>\n<p>3.14159 for PI.<\/p>\n<p>\u00ef\u201a\u00b7 If the user enters 2, then prompt for the length and width of the rectangle, and then display the<\/p>\n<p>rectangle\u00e2\u20ac\u2122s area.<\/p>\n<p>\u00ef\u201a\u00b7 If the user enters 3, then prompt for the base and height of the triangle, and then display its<\/p>\n<p>area.<\/p>\n<p>\u00ef\u201a\u00b7 If the user enters 4, the program should end.<\/p>\n<p>Input validation:<\/p>\n<p>Display an error message if the user enters a menu number outside the range of 1 through 4 and end<\/p>\n<p>the program.<\/p>\n<p>Only accept positive values for the circle\u00e2\u20ac\u2122s radius, the rectangle\u00e2\u20ac\u2122s length or width, or the triangle\u00e2\u20ac\u2122s base<\/p>\n<p>or height. Display an error message and end the program.<\/p>\n<p>Test data: Your included output must show your program running with the following sequence.<\/p>\n<p>Menu choice 1. Radius = 3.7<\/p>\n<p>Menu choice 2. length = 5.5, width = 3.<\/p>\n<p>Menu choice 4. Should quit program.<\/p>\n<p>Menu choice 9. Should generate error message.<\/p>\n<p>Menu choice 3. base = -6.2, height = 4. Should generate error message.<\/p>\n<p>Example output:<\/p>\n<p>***Geometry Calculator***<\/p>\n<p>1. Calculate the area of a Circle<\/p>\n<p>2. Calculate the area of a Rectangle<\/p>\n<p>3. Calculate the area of a Triangle<\/p>\n<p>4. Quit<\/p>\n<p>Enter your choice (1-4): 1<\/p>\n<p>Enter the circle&#8217;s radius: 3.7<\/p>\n<p>The area is 43.0084<\/p>\n<p>Thanks for using the Geometry Calculator!<\/p>\n<p>Press any key to continue . . .CSC100AA and CIS162AA Chapter 4 : Making Decisions<\/p>\n<p>Ch4 Program 2 &#8211; GeometryCalculator.doc pbaker page 1 of 2<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Learning Goal: I&#8217;m working on a c++ project and need the explanation and answer to help me learn. Ch 4 Program 2 \u00e2\u20ac\u201c GeometryCalculator Please adhere to the Standards for Programming Assignments and the C++ Coding Guideline. Submit the following: \u00ef\u201a\u00b7 List of source code with comments to document \u00ef\u201a\u00b7 Test output listed as comments [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":[],"disciplines":[763],"paper_types":[],"tagged":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/questions\/5399"}],"collection":[{"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/questions"}],"about":[{"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/types\/questions"}],"author":[{"embeddable":true,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/comments?post=5399"}],"version-history":[{"count":0,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/questions\/5399\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/media?parent=5399"}],"wp:term":[{"taxonomy":"disciplines","embeddable":true,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/disciplines?post=5399"},{"taxonomy":"paper_types","embeddable":true,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/paper_types?post=5399"},{"taxonomy":"tagged","embeddable":true,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/tagged?post=5399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}