Question: Java Problem 1: Suppose Dave drops a watermelon off a high bridge and lets it fall until it hits the water. If we neglect air
Java
Problem 1: Suppose Dave drops a watermelon off a high bridge and lets it fall until it hits the water. If we neglect air resistance, then the distance d in meters fallen by the watermelon after t seconds is d = 0.5 * g * t2, where the acceleration of gravity g = 9.8 meters/second2. Write a program that asks the user to input the number of seconds that the watermelon falls and the height h of the bridge above the water. The program should then calculate the distance fallen for each second from t = 0 until the value of t input by the user. If the total distance fallen is greater than the height of the bridge, then the program should tell the user that the distance fallen is not valid.
Sample Run 1:
Please input the time of fall in seconds:
2
Please input the height of the bridge in meters:
100
Time Falling (seconds) Distance Fallen (meters)
******************************************************
0 0
1 4.9
2 19.6
Sample Run 2:
Please input the time of fall in seconds:
4
Please input the height of the bridge in meters:
50
Time Falling (seconds) Distance Fallen (meters)
**************************************************
0 0
1 4.9
2 19.6
3 44.1
4 78.4
Warning-Bad Data: The distance fallen exceeds the height of the bridge
Problem 2: The University of Guiness charges $3000 per semester for in-state tuition and $4500 per semester for out-of-state tuition. In addition, room and board is $2500 per semester for in-state students and $3500 per semester for out-of-state students. Write a program that prompts the user for their residential status (i.e., in-state or out-of-state) and whether they require room and board (Y or N). The program should then compute and output their bill for that semester.
Use the sample output below:
Sample Run 1:
Please input "I" if you are in-state or "O" if you are out-of-state:
I
Please input "Y" if you require room and board and "N" if you do not:
N
Your total bill for this semester is $3000
Sample Run 2:
Please input "I" if you are in-state or "O" if you are out-of-state:
O
Please input "Y" if you require room and board and "N" if you do not:
Y
Your total bill for this semester is $8000
Problem 3: Write a program that performs a survey tally on beverages. The program should prompt for the next person until a sentinel value of 1 is entered to terminate the program. Each person participating in the survey should choose their favorite beverage from the following list: 1. Coffee 2. Tea 3. Coke 4. Orange Juice
Sample Run:
Please input the favorite beverage of person #1: Choose 1, 2, 3, or 4 from the
above menu or -1 to exit the program
4
Please input the favorite beverage of person #2: Choose 1, 2, 3, or 4 from the
above menu or -1 to exit the program
1
Please input the favorite beverage of person #3: Choose 1, 2, 3, or 4 from the
above menu or -1 to exit the program
3
Please input the favorite beverage of person #4: Choose 1, 2, 3, or 4 from the
above menu or -1 to exit the program
1
Please input the favorite beverage of person #5: Choose 1, 2, 3, or 4 from the
above menu or -1 to exit the program
1
Please input the favorite beverage of person #6: Choose 1, 2, 3, or 4 from the
above menu or -1 to exit the program
-1
The total number of people surveyed is 5. The results are as follows:
Beverage Number of Votes
********************************
Coffee 3
Tea 0
Coke 1
Orange Juice 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
