This one isnt my homework but its in my book and im finding it hard so i want to see you guys do it.
Who ever does it first gets rep i guess.
Also make itnot case sensitive and use java lol. Use JOptionPane if you want but it would be better for me.
The problem is :
Code: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 = Distance/1,100 You can calculate the amount of time it takes sound to travel in water 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,400
Results 1 to 2 of 2
Thread: Do it!
- 06 Mar. 2013 04:40am #1
- Age
- 97
- Join Date
- Nov. 2009
- Location
- In the computer
- Posts
- 11,186
- Reputation
- 1029
- LCash
- 0.25
- Awards
Do it!
Last edited by Taz; 06 Mar. 2013 at 04:43am.
- 06 Mar. 2013 05:43am #2
Global $sInput = ""
Global $iDistance = 0
$sInput = InputBox("Taz", "Enter 'air', 'water' or 'steel' as input for our assessment.")
$iDistance = InputBox("Taz", "Enter the distance a sound wave will travel throughout " & $sInput & '.')
Switch $sInput
Case "air"
MsgBox(0, "", $iDistance / 1100)
Case "water"
MsgBox(0, "", $iDistance / 4900)
Case "steel"
MsgBox(0, "", $iDistance / 16400)
Case Else
ConsoleWrite("Invalid input provided!" & @CRLF)
EndSwitch
Slapped that together in AutoIt. Can't use anything else right now. Should work. Just port it to Java. Simple enough.Last edited by The Unintelligible; 06 Mar. 2013 at 05:47am.