Write the methods displaymenu and soundspeed

Assignment Help JAVA Programming
Reference no: EM131590576

The following table shows the approximate speed of sound in air, water, and steel.

Medium Speed
Air 1,100 feet per second
Water 4,900 feet per second.
Steel 16,400 feet per second.
Now, write the following two methods:

The first one calledDisplayMenuthat takes no parameters and returns back an integer value. The method displays a menu allowing the user to select air, water, or steel. The method returns back an integer value that represents the user choice.Input validation: Make sure that this value is a numerical value, and it is a value only between 1-3. Remember input validation and verification from week 4, check the example given in the class under lecture/week4

The second one calledSoundSpeedthat takes one parameter -that represents the user choice from the method DisplauMenu- and it returns back an double value.The method asks the user to input the distance a sound wave will travel in the selected medium, then based on the parameter, the method calculates and displays the amount of time it will take for the sound to get through the chosen medium (round the answer to 4 decimal places).Input validation: Make sure that distance is a positive number.

Reference no: EM131590576

Questions Cloud

Elements of innate immunity : Which of these elements of innate immunity (barriers, secretion, inflammatory response, phagocytosis) would be involved in fighting the infection described.
Can you think of a position could be eliminated : Can you think of a position within your organization that could be eliminated? Why should it be eliminated? Why should it be added?
How much mybook stock is expected to move according to capm : how much the MyBook stock is expected to move according to CAPM.
Write a summary review of the important materials presented : Write a summary review of the important materials presented, The Longitudinal Impacts of Deterrence and Post-Treatment Effects of Displacement
Write the methods displaymenu and soundspeed : Write the method DisplayMenu and SoundSpeed- Make sure that distance is a positive number.
Calculate the amount of stans tax at his parents rate : For purposes of the tax on a child's unearned income, calculate Stan's net unearned income. Calculate the amount of Stan's tax at his parents' rate
What ethical problems-implications does this study present : Main ethical considerations/study implications for research subjects in general. What ethical problems/implications does this study present?
Main sensory organs in the head : Trace the pathway between the brain and one of the main sensory organs in the head.
Discussion the standard of care for police use : discussion the standard of care for police use of force as well as what actions on the part of a suspect justify an increased

Reviews

Write a Review

JAVA Programming Questions & Answers

  What is the purpose of using javascript on a website

What is the purpose of using JavaScript(r) on a website? What is a specific example of a JavaScript(r) application that will be beneficial on the site you are creating

  Test a java application that will read file containing data

Design, Implement and test a Java application that will read a file containing data related to the passengers on the Titanic

  Creating a switch-case statement

Creating a switch-case Statement - Propagating and Catching an Exception - Create a method called reverse - Create an enclosing class called MyException

  Design a dynamic programming algorithm

Design a dynamic programming algorithm to find the value of the optimal plan. Implement your algorithm using any programming language you prefer.

  Write the java code for an abstract class named account

Write the Java code for an abstract class named Account which has two data members; one for the account number and the other for the account balance (use information hiding). The Account class should include get and set methods for both data membe..

  Algorithm analysis with advanced data structures

Algorithm Analysis with Advanced Data Structures, Your good friend, a Rock Star, asked you to create a Time Manager app for him, The Rock Star performs gigs at certain dates, all around the country - at most one gig per day

  Javas drawing capabilities

This week, we will be learning to use some of Java's drawing capabilities. The Graphics class provides methods for drawing many different shapes, using different colors, and for drawing strings using different fonts.

  To translate infix mathematical expression

Write a program in java to translate infix mathematical expression into postfix expression and a program to evaluate the postfix expression

  Create a japplet that contains a jlabel and jbutton

Create a JApplet that contains a JLabel and JButton -  create an HTML document to host the applet, set the Width to 450 and the Height to 200. Save as TestJChangeFont.html.

  Prepare a program to triple each number in the list

Write a program that will read in a list of numbers, triple each number in the list and print the result - Write a program that will read in 2 numbers per line, and print the sum.

  Write a java program that declares an array alpha of 50

Write a Java program that declares an array alpha of 50 elements of type double. Initialize the array so that the first 25 elements are equal to the square of the index variable, and the last 25 elements are equal to three times the index variable. O..

  Create an application named numbers.

Create an application named Numbers. The Numbers class should have non-static public methods named sum and difference, each taking a pair of int variables as arguments. As you might expect, the sum method should add the two integers and return the..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd