Starting Out with Programming Logic and Design (4th Edition)
Starting Out with Programming Logic and Design (4th Edition)
4th Edition
ISBN: 9780133985078
Author: Tony Gaddis
Publisher: PEARSON
Question
Book Icon
Chapter 11, Problem 3PE
Program Plan Intro

Geometry Calculator

Program Plan:

  • Include the required header files.
  • Define the main(),
    • Declare the required variables.
    • Display the menu options on the screen.
    • Get the choice from the user.
    • Using switch case,
      • Validate the user choice
        • Case 1:
          • Get the required input from the user.
          • Calculate the area of the circle.
          • Display the result on the screen.
        • Case 2:
          • Get the required input from the user.
          • Calculate the area of the rectangle.
          • Display the result on the screen.
        • Case 3:
          • Get the required input from the user.
          • Calculate the area of the triangle.
          • Display the result on the screen.

Blurred answer
Students have asked these similar questions
The program below display the following menu:Geometry Calculator1. Calculate the Area of a Circle2. Calculate the Area of a Rectangle3. Calculate the Area of a Triangle4. Quit Enter your choice (1-4):If the user enters 1, the program should ask for the radius of the circle and then display its area. Use 3.14159 for . If the user enters 2, the program should ask for the length and width of the rectangle, and then display the rectangle’s area. If the user enters 3, the pro- gram should ask for the length of the triangle’s base and its height, and then display its area. If the user enters 4, the program should end. Input Validation: Display an error message if the user enters a number outside the range of 1 through 4 when selecting an item from the menu. Do not accept negative values for the circle’s radius, the rectangle’s length or width, or the triangle’s base or height. You are therefore, required to complete the program by putting in codes under each comment.include…
USE ONLY PYTHON CODE   Write a program that displays the following menu: Geometry Calculator 1. Calculate the Area of a Circle 2. Calculate the Area of a Rectangle 3. Calculate the Area of a Triangle 4. Quit Enter your choice (1-4). If the user enters 1, the program should ask for the radius of the circle and then display its area.  Use the following formula to calculate the circle's area: area = pi * r ** 2 Use 3.114159 for pi and the radius of the circle for r.  If the user enters 2, the program should ask for the length and width of the rectangle, and then display the rectangle, and then display the rectangle's area.  Use the following  formula to calculate the rectangle's area: area = length x width If the user enters 3, the program should ask for the length the tringle's base and its height,  and then display its area.  Use the following formula to calculate the area of the triangle: area = basse x height x .5 If the user enters 4, the program should end.     PHYTON CODE!!
Percentage of vehicles: Write an interactive program that asks the users to input the number of cars, trucks and suv that entered a parking lot. Your progam should then calculate the percetages of each vehicle type and display the result.

Chapter 11 Solutions

Starting Out with Programming Logic and Design (4th Edition)

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT