1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
garik1379 [7]
3 years ago
5

The Speed of Sound (Java Project. Please make it easy to understand. I'm a beginner at this. I believe we are supposed to use a

switch or if/else) The speed of sound depends on the material the sound is passing through. Below is the approximate speed of sound (in feet per second) for air, water and steel: air: 1,100 feet per second water: 4,900 feet per second steel: 16,400 feet per second Write a program class TheSpeedOfSound 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 = distance/1,100 You can calculate the amount of time it takes sound to travel in watert with the following formula: time = distance/4,900 You can calculate the amount of time it takes sound to travel in steel with the following formula: time = distance/16,400the user should enter an "A" for "air", a "W" for "water, and an "S" for steel and the distance.use the switch statement as part of your solution.display your answer using the printf statement.
Computers and Technology
1 answer:
Ilya [14]3 years ago
6 0

Answer:

The program of this question can be given as:

Program:

//import pacakge for user input.

import java.util.Scanner;

//define class  

public class SpeedofSound              

{

  public static void main(String a[]) //define main function

  {  

      //define variable.

      String medium;                            

      double distance,time=0;

      //creating Scanner class object for input from user.

      Scanner s=new Scanner(System.in);  

      //print message.

      System.out.printf("Enter medium(air,water or steel) : ");

      medium=s.nextLine();  //taking input.

      //print message.

      System.out.printf("Enter the distance that the sound will travel : ");

      distance=s.nextDouble(); //taking input.

      switch(medium) //checking condtion between range.

      {

          case "air":

                  time=distance/1100;         //apply formula

                  break;

          case "water":

                  time=distance/4900;            //apply formula

                  break;

          case "steel":

                  time=distance/16400;            //apply formula

                  break;

          default:

                  System.out.printf("Sorry, you must enter air,water or steel"); //error for invalid input of medium

                  System.exit(0);

      }

      System.out.printf("It take "+time+" seconds"); //print final answer.

  }

}

Output:

Enter medium(air,water or steel) : air

Enter the distance that the sound will travel : 200

It take 0.18181818181818182 seconds

Explanation:

In this program first, we import packages for user input. Then we declare the class in the class we declare all the variables and then we create the scanner class object. It is used for taking input from the user. Then we use the switch statement It is used for condition. It works between the ranges. In the switch statement, we apply all the formula that is given in the question. and at the last, we print the output using printf function in java.

You might be interested in
Write a Python function called validateCreditCard that takes 8-digit credit card number as the input parameter (string value) an
babunello [35]

Answer:

def validateCreditCard(x):

      if type(x)==str and len(x) == 8:

           print("Valid credit card number")

      else:

          print("Invalid credit card number")

validateCreditCard("43589795")

Explanation:

Run the code on your text editor(vs code, sublime, pycharm ) you will get your desired response. If your input is not of type string and not up to 8 digit you will get the response "invalid credit card number" but if it is of type string and up to 8 digit you will get "Valid credit card number".

But remember python works with indentation so when you are transferring this code to your text editor it will run properly well.

I defined the code using the conventional pattern "def"

After defining the function you create a brackets (x) to accommodate your argument x and end it with a semi colon.  

Then i use "if" statement to make sure only string argument and 8 digit value will be accepted to print a "valid credit card". if your argument does not pass the if statement condition it will print out the else statement condition which is "Invalid credit card number"

Finally, you have to call your function and test various values.

     

   

6 0
3 years ago
listen to exam instructions a small business called widgets, inc. has hired you to evaluate their wireless network security prac
Alex

Following actions could you most likely advise the client taking to strengthen the security of their wireless network-

  • Change the default SSID to anything different.
  • Turn off SSID broadcasting.
<h3>Explain the term wireless network security?</h3>
  • Designing, putting into practice, and ensuring security on such a wireless computer network are all parts of wireless network security.
  • A wireless computer network is further protected by this subset of network security.
  • Wireless security is another name for wireless network security.

For the stated question-

  • Disabling SSID broadcast and changing the network name are advised.
  • By disabling SSID, the network name won't be displayed on devices looking for a network can connect to, and so by changing the name, it will be impossible for anyone who already knows the old name to connect.
  • Both of which significantly boost security.

To know more about the wireless network security, here

brainly.com/question/28257213

#SPJ4

3 0
1 year ago
Anyone help me please​
MissTica

Answer:

1. True

2. False

3. True

4. False

5. True

6. True

7. False

4 0
3 years ago
Read 2 more answers
The size of the board is one of the differences between Elevens and Thirteens. Why is size not an abstract method?
Levart [38]

Answer:

The program keeps track of the size of the board in cards.size(). The sub class sets this by passing it into the constructor. After that, the subclass never cares about the size of the board, so it's not necessary to make it accessible with an abstract method. Any need for it is covered by cardIndexes method.

Explanation:

The differences between Elevens and Thirteens

The program keeps track of the size of the board in cards.size(). The sub class sets this by passing it into the constructor. After that, the subclass never cares about the size of the board, so it's not necessary to make it accessible with an abstract method. Any need for it is covered by cardIndexes method.

5 0
3 years ago
Assume you're using a three button mouse. to access shortcut menus, you would
Likurg_2 [28]
<span>Normally you would click the right hand/secondary mouse button but you may configure any of the buttons to work within the Keyboard and Mouse section of System Preferences.
Hope this helps:)</span>
6 0
3 years ago
Read 2 more answers
Other questions:
  • What is process equipment?
    12·1 answer
  • what type of clause must you always use with DEKETE or UPDATE to avoid inadvertently changing data elsewhere in the database​
    12·1 answer
  • Convert to octal. Convert to hexadecimal. Then convert both of your answers todecimal, and verify that they are the same.(a) 111
    12·1 answer
  • WHEN COPYING EXISTING SPREADSHEET DATA TO A WORD DOCUMENT YOU NEED TO SELECT?
    12·1 answer
  • How are a cell's content and format related?
    12·2 answers
  • A number of related records that are treated as a unit is called
    6·1 answer
  • If given the chance to own manage a business,what will be the name of the business?
    11·2 answers
  • A sequence of one or more characters is called
    14·1 answer
  • What is human data,
    8·1 answer
  • MORE FREEE POINTS AYEEE
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!