
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
For this question, you are required to use switch statement and dialog boxes for input and output.

Transcribed Image Text:Decis
12. The Speed of Sound
The folowing table shows the approximate speed of sound in air, water, and steel:
Medium
Speed
1,100 feet per second
4,900 feet per second
16,400 feet per second
Air
Water
Steel
Write a program that asks the user to enter "air", "water", or “steel", and the distance that
a sound wave will travel in the medium. The program should then display the amount of
time it will take. You can calculate the amount of time it takes sound to travel in air with
the following formula:
Time = Distancel1,100
You can calculate the amount of time it takes sound to travel in water with the following
formula:
Time = Distancel4,900
You can calculate the amount of time it takes sound to travel in steel with the following
formula:
Time = Distancel16,400
Expert Solution

arrow_forward
Step 1
Program planning
Here, java swing is used to create the required application.
JOptionPane.showInputDialog() is used to input medium name and distance traveled.
JOptionPane.showMessageDialog() is used to display the time taken by the sound wave.
Step by stepSolved in 2 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Trace the following flowchart and complete the Table l (fill in ALL the blanks). Start 13 is Dinplay Display DO NOT leave the blank spoce. If the value of the varioble is not changed, fill the blank with the same value. Table 1 n<15 in/2 Outputarrow_forwardq24- You are writing code which asks the user to input a number and prints "odd" if it is odd, and "even" otherwise. Which kind of control structure would best describe the code? Ensure that you select the answer which also includes a correct explanation. a. Sequence, because the program involves input/output. b. Selection, because control flow can take one of multiple possible paths based on a condition. c. Selection, because input is selected from the user. d. Iteration, because there are statements that can be executed repeatedly. e. Sequence, because there is only one possible sequence of statements that can be executed. f. Iteration, because multiple versions of the program must be written.arrow_forwardExplain how to check for an invalid input number and prevent it being used in a program. You may assume that the user enters a number.arrow_forward
- Which of the following can you nest within one another? A. for loop within an if statement B. while loop within a for loop C. if statement in a for loop D. for loop within a for looparrow_forwardPlease make additional adjustments to the C++ code. There is only one infrared LED. If a non-moving train is detected (and stops for a few seconds), the LED should be turned on. The LED should always stay turned off if: There is no train detected At least one train bypasses without stoppingarrow_forwardIs it possible for both the Sign and Zero flags to be set at the same time?arrow_forward
- Write a pseudocode and flowchart and add in a while loop and a do- while loop(can be any scenario related to the question) for a store that wants to ask a user to enter daily sales, calculate weekly total and display the results. declare all variables and use proper indentation.arrow_forwardwhat is start/stop symbol?arrow_forwardWrithe the pseudocode and draw the flowchart using for loop to read five numbers and finds their sum and average.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education