Goal For this project you will need to write a complete Java program You do not need to submit a

Goal For this project, you will need to write a complete Java program. You do not need to submit a design document, but your code design will factor into your grade. Note: You do not need to build a Swing GUI for this program. Requirements 1) Must allow the user to enter the simulation's initial condition: the starting height of the billiard ball (yi). 2) Must simulate the billiard ball's descent from height yi to the ground (y=0). 3) The output CSV file must have columns for the following data... 3.1) Time (in seconds) starting from 0 3.2) Height (in meters) of the ball 3.3) Velocity (in meters per second) 4) The output CSV file must contain the ball's height and velocity at each second from the time the ball was dropped until the time the ball hits the ground. Usage Example User input is shown in bold, console output is shown in plain text. Please enter simulation parameters... Initial Height (in meters): 5 Simulating... t=0 t=1 t=2 t=3 t=4 Writing to simulationdata.csv... Done. Note: Given the small amount of user interaction in this project, you may include more detail in your console output as the simulation runs. I would recommend doing so to help debug. CSV File Format The data generated by the program must be saved to a file where each row represents one height measurement. The first row of the file should list the column (variable) names, in this case time, height, and velocity. On each row after the column names, the three numerical values should be separated by a comma (,). Example time, height, velocity 0,8.0,0.0 1,7.3,1.2 2,6.0,1.8 3,4.4,2.6 4,2.8,3.7 5,0.0,4.5 time, height, velocity 0,8.0,0.0 1,7.3,1.2 2,6.0,1.8 3,4.4,2.6 4,2.8,3.7 5,0.0,4.5 (Note: this example demonstrates the file format only, do not use it to verify the simulation data) Valid CSV files can be opened in Microsoft Excel, Google Sheets, etc Imagine you are collaborating with a physics lab on campus. They would like to compare data collected from real-world studies with simulated data. Several experiments were performed to study the effect of air resistance on a falling billiard ball. The team needs a program which can simulate the position of the billiard ball in free-fall under simple, idealized conditions and produce a CSV file of the ball's position over time. Our simulation will neglect air resistance, etc. Sphere falling from a height The position or height of the falling billiard ball can be simulated with the following equation: y(t) = yi - (1/2) * g * t^2 where.. y(t) is the height of the ball at time t yi is the starting (initial) height g is the acceleration due to gravity (9.81 m/s^2) t is the amount of time the ball has been falling

Goal

For this project, you will need to write a complete Java program. You do not need to submit a design document, but your code design will factor into your grade. Note: You do not need to build a Swing GUI for this program.

Requirements

1) Must allow the user to enter the simulation’s initial condition: the starting height of the billiard ball (yi).

2) Must simulate the billiard ball’s descent from height yi to the ground (y=0).

3) The output CSV file must have columns for the following data…

3.1) Time (in seconds) starting from 0

3.2) Height (in meters) of the ball

3.3) Velocity (in meters per second)

4) The output CSV file must contain the ball’s height and velocity at each second from the time the ball was dropped until the time the ball hits the ground.

Usage Example

User input is shown in bold, console output is shown in plain text.

Please enter simulation parameters…
Initial Height (in meters): 5

Simulating…
t=0
t=1
t=2
t=3
t=4

Writing to simulationdata.csv…
Done.

Note: Given the small amount of user interaction in this project, you may include more detail in your console output as the simulation runs. I would recommend doing so to help debug.

CSV File Format

The data generated by the program must be saved to a file where each row represents one height measurement. The first row of the file should list the column (variable) names, in this case time, height, and velocity. On each row after the column names, the three numerical values should be separated by a comma (,).

Example
time, height, velocity
0,8.0,0.0
1,7.3,1.2
2,6.0,1.8
3,4.4,2.6
4,2.8,3.7
5,0.0,4.5

time, height, velocity
0,8.0,0.0
1,7.3,1.2
2,6.0,1.8
3,4.4,2.6
4,2.8,3.7
5,0.0,4.5

(Note: this example demonstrates the file format only, do not use it to verify the simulation data)

Valid CSV files can be opened in Microsoft Excel, Google Sheets, etc

Imagine you are collaborating with a physics lab on campus. They would like to compare data collected from real-world studies with simulated data. Several experiments were performed to study the effect of air resistance on a falling billiard ball. The team needs a program which can simulate the position of the billiard ball in free-fall under simple, idealized conditions and produce a CSV file of the ball’s position over time. Our simulation will neglect air resistance, etc.

Sphere falling from a height

The position or height of the falling billiard ball can be simulated with the following equation:
y(t) = yi – (1/2) * g * t^2

where..
y(t) is the height of the ball at time t
yi is the starting (initial) height
g is the acceleration due to gravity (9.81 m/s^2)
t is the amount of time the ball has been falling


 
Solved By Verified
Study Co-Pilot All Study Co-Pilots are evaluated by Gotit Pro as an expert in their subject area.

 
Instant
Download

Student review: (4 ratings) 4 out of 4 people found this solution helpful.