Must be in OOP FormatCatapult.javaCatapultTester.java
Text File is also attached that the program will need to read called "catapult - test data.txt".
Please provide comments throughout code for understanding.
5 5 10 20 30 40 50 8 10 20 30 40 50 60 70 80 100 300 8 10 15 20 25 30 35 40 45 8 10 15 20 25 30 35 40 45 10 1000 3 500 600 900 2 100 200 10 10000 1 300 8 5 10 15 20 25 30 35 40 100 200 7 20 25 30 35 40 45 50 6 25 30 35 40 45 50 300 400 Overview You are a part of a team that will be completing at a Catapult Contest. Your team will be attacking the castle. The goal is to launch the catapult over the wall surrounding the castle but not go beyond the far castle wall. To help your team to victory, you need to write a program to calculate the trajectory of a projectile based on launch angles and launch velocities. It will create a matrix of all of the possible trajectories as well as the trajectories to help your team hit the target range. Review the information about calculating projectile trajectories in the Background Information section below. Look up the toRadians() and the sin() methods in the Java API for the Math class. Remember, the sin() method parameter must be in radians so the degrees given must converted to radians. Take time to plan your project. The program must use an OOP design. Specifications Rules The program will create a Catapult object that will create a searchable matrix of trajectories for the given speeds and angles. The object should store these values in a 2D array. Given a target range of minimum and maximum distances, representing the near and far castle walls, the program should search the calculated trajectories and return a list of speed and angle combinations that can be used by your team to successfully launch the catapult. The output should be in an easy to read human readable format. If there are no speed and angle pairs in the current set that will accomplish the goal in the current matrix, the program should also graciously tell the users that they do not have a viable launch. The program will have a number of potential sets of speeds and angles. The program should be able to run the simulation as many times as indicated by the user (found in the text file). Input will be done from a text file rather than keyboard input. The program will take input from a text file containing the following information on each line: Number of sets Number of speeds, followed by a list of speeds Number of angles, followed by a list of angles Minimum trajectory Maximum trajectory **speeds, angles, maximum and minimum repeated for the specified number of sets Download the test data file linked from the same section as the assignment. Sample Text File contents: Expected Output: When your program runs correctly, the program should output a table of possible distance values and under the table there should be a list of the speed and angle pairs that match. Note, there will be a series of projectile tables in the output – one for each of the tests. When the program is run, there should be a projectile table and a set of best trajectory values for each set. If there are 7 sets of data, there should be 7 tables in the output. The image below is an example for 1 set of data. The format of the output table should resemble the following, but with the appropriate data for each row and column. Java Requirements The program must utilize single dimensional arrays to store the speeds and angles. At a minimum, you will need one 2D array to store the values for the trajectories. How you define the logic and utilize these arrays is up to you. The program must be created from an object-oriented perspective. Most of the work should be completed in the object class. The program must use methods appropriately. Background Information: Trajectory of a Projectile The distance (R) of a projectile can easily be calculated using the following simple algebraic formula, if a few complicating factors are ignored (e.g., wind speed, drag coefficient, etc.). Suppose you could launch a projectile at a speed of 40 meters/second (about 90 miles per hour) and a launch angle of 25 degrees. How far down range (R) in meters could the projectile be hurled? The solution for finding the down range distance of a projectile launched at a speed of 40 m/s and a launch angle of 25° is shown here. Remember, that Angles are giving in degrees, so the degrees must first be converted to radians. Be sure that you can work through the algebra and solve the equation with a calculator. Soon, you will turn it into an arithmetic expression in Java. In programming pseudocode, the calculation would look something like this: result = current_speed raised to the power of 2 * the sin of the angle in radians * 2 / gravitational constant Be sure that the gravitational constant in the correct form for the unit of measure you are using. Work out several answers with pencil, paper, and calculator first, before attempting to write the program. Pay close attention to units. The final units should be in meters. Rubric Catapult Rubric Criteria Ratings Pts This criterion is linked to a Learning Outcome OOP design used and Catapult object created correctly 10.0 pts Full Marks OOP design used and the Catapult object creates a searchable matrix of trajectories for the given speeds and angles 5.0 pts Partial Credit OOP design not used or the Catapult object does not correctly create a searchable matrix of trajectories for the given speeds and angles 0.0 pts No Marks OOP design not used nor does the Catapult object correctly create a searchable matrix of trajectories for the given speeds and angles 10.0 pts This criterion is linked to a Learning Outcome Calculations are correct and the appropriate Math class methods are used 10.0 pts Full Marks Calculations are correctly created and use the sin() and toRadians() methods where appropriate 5.0 pts Partial Credit Calculations are incorrect or the sin() and toRadians() methods where not used 0.0 pts No Marks Calculations are incorrect and the sin() and toRadians() methods where not used 10.0 pts This criterion is linked to a Learning Outcome Input read from a text file and calculations stored correctly 10.0 pts Full Marks Input read from a text file and the calculations are stored appropriately 5.0 pts Partial Credit Input is not read from a text file or is hard coded or the calculations are not stored appropriately 0.0 pts No Marks Input is not read from a text file or is hard coded and the calculations are not stored appropriately 10.0 pts This criterion is linked to a Learning Outcome Single dimensional arrays used appropriately 10.0 pts Full Marks Single dimensional arrays used to store the speed and angle values. Loops are used to iterate through the arrays 5.0 pts Partial Credit Single dimensional arrays used to store either the speed and angle values. Loops are used to iterate through the arrays 0.0 pts No Marks Speed and angle values are not stored in arrays. Loops are not used to iterate through the arrays 10.0 pts This criterion is linked to a Learning Outcome 2D array(s) used appropriately 10.0 pts Full Marks 2D array(s) are used to store the calculated values. Loops are used to iterate through the array(s) 5.0 pts Partial Credit 2D array(s) are used to store the calculated values. Loops are consistently used to iterate through the array(s) 0.0 pts No Marks The calculated results are not stored in a 2D array. Loops are not used to iterate through the array(s) 10.0 pts This criterion is linked to a Learning Outcome Output is correct 10.0 pts Full Marks Output is correct and contains all of the possible distances in a table. Under the tables there should be a list of the speed and angle pairs that fit the requirements 5.0 pts Partial Credit Output is mostly correct but there are elements are missing from the required output 0.0 pts No Marks The output is mostly incorrect. A majority of the elements are missing 10.0 pts This criterion is linked to a Learning Outcome Code compiles and runs without errors 15.0 pts Full Marks Code compiles and runs without errors 0.0 pts No Marks Code does not compile 15.0 pts This criterion is linked to a Learning Outcome Code is properly commented 10.0 pts Full Marks Code is properly comment ed including all required header informati on 5.0 pts Partial Credit Code has some of the required comments but is sparsely commented or missing the correct header information 0.0 pts No Marks Code is sparsely commented or not commented at all and is missing all or most of the correct header information 10.0 pts This criterion is linked to a Learning Outcome Program is properly designed and uses whitespace effectively 15.0 pts Full Marks Program is properly designed and uses whitespace effectively 5.0 pts Partial Credit Program is not properly designed or it does not use whitespace effectively 0.0 pts No Marks Program is not properly designed and it does not use whitespace effectively 15.0 pts Total Points: 100.0 PREVIOUSNEXT Here is the pseudocode that I would use: read in the first value - that is the number that controls the number of sets so it controls the number of iterations for my outer loop read in the next number - that is the number that identifies the number of speeds and can be used to both size my speed array and as the loop control to read in the values loop the specified number of times to fill the array reading in one value at a time. read in the next number (which is on line 3) and use that to size the angles array and control the loop loop the specified number of times to fill the array read in the max read in the min You can then send the 1d array of speeds, the 1d array of angles, the max and min into the object. The object can walk the arrays as one represents the row and the other the column, pick the appropriate value from each array, calculate and store the result in the 2d array. Once you have the 2d array, print the results, walk it and find the values that fit between max and min and print those value. ---------- Pseudocode from lecture (zoom) Read in # of sets nextInt() Loop for the number of sets Read in # speeds nextInt() Size speeds array Loop # speeds Read in 1 speed at a time nextInt()