Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
5th Edition
ISBN: 9780134801155
Author: Tony Gaddis
Publisher: PEARSON
Question
Book Icon
Chapter 11, Problem 7PE
Program Plan Intro

The speed of the sound

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:
          • Set the corresponding speed for “Air”.
          • Get the number of seconds that the sound travels.
          • Calculate the total distance amount.
        • Case 2:
          • Set the corresponding speed for “Water”.
          • Get the number of seconds that the sound travels.
          • Calculate the total distance amount.
        • Case 3:
          • Set the corresponding speed for “Steel”.
          • Get the number of seconds that the sound travels.
          • Calculate the total distance amount.
        • Case 4: Exit the program.

Blurred answer
Students have asked these similar questions
Geometry Calculator 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: area = Pi*r^2 Use 3.14159 for 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’s area. Use the following formula: area = length * width If the user enters 3 the program should ask for the length of the triangle’s base and its height, and then display its area. Use the following formula: area = base * height * .5 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…
Menu of the Day Create a program that filters and displays the correct menu items based on the day that the user enters. Console Menu of the Day   COMMAND MENU Specify the day using the three-letter format (mon, tue, wed, thu, fri, sat, sun). Or, enter 'exit' to exit.   Day:  mon Roast beef               10 Potato soup              6 Baked cod                10   Day:  tue Butter chicken           11 Lamb tikka               12 German forest cake       7   Day:  exit Bye! Specifications A tab-delimited text file named menu.txt that contains the menu items for the current week is attached. Each item has a name (a string), price (an integer), and associated day (a string) Use a structure named MenuItem to store the name, price, and day for each menu item. When the program starts, it should load the items from the file into a vector of MenuItem objects. The user should be able to type a three-letter day code to display the menu items for the specified day. The user should be able to…
Tuition Increase At one college the tuition for a full-time student is $6000 per semester. It has been announced that the tuition will increase by 2 percent each year for the next five years. Create an application with a loop that displays the projected semester tuition amount for the next 5 years in a ListBox control.

Chapter 11 Solutions

Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education