Question
Create a project in NetBeans. Create four classes, Trainee, JumpingCalculator, JumpingTraining, and TrainProgLoader. Save them to Trainee.java, JumpingCalculator.java, JumpingTraining.java, and TrainProgLoader.java. Code the classes as
Create a project in NetBeans. Create four classes, Trainee, JumpingCalculator, JumpingTraining, and TrainProgLoader. Save them to Trainee.java, JumpingCalculator.java, JumpingTraining.java, and TrainProgLoader.java. Code the classes as specified as follows. Compile and run to test the program. Trainee Class This class represents a trainee. Fields o a private int data field named id; o a private String data field named name; o a private boolean data field named jumpTrain; o a private static int data field named numOfTrainee; Methods o a constructor that takes id and name as the parameters, and increments numOfTrainee by 1 o a getName method that returns the name; o a static getNumOfTrainee method that returns the numOfTrainee field; o a setJumTrain method that takes a boolean parameter and sets the jumpTrain field; o a printInfo method that prints the three data fields: id, name, jumpTrain JumpingCalculator Class This class conducts the calculations. Field o a public static final double data field name g and is given a value 9.8. It is the gravity force. Methods: all the following three methods take two double parameters: velocity and angle. The angle is in degree. To convert degree to radians, use double Math.toRadians(degree). Read Projectile Motion Calculator to understand how the calculations are done. o a public static method distance that return a double value as the range of projectile; o a public static method timeOfFlight that return a double value as the time of flight; o a public static method height that return a double value as the maximum height. PROG23199 Winter 2020 Assignment 2 2 o Note: An example implementation of the class (JumpingCalculator.java) can be downloaded from SLATE. You can directly use it without change, or you can make your own JumpingCalculator class if you like. JumpingTraining Class This is the jumping training class that guides the user to pass the training. Fields o a public static final double data field named theDistance and is given a value 100.0. Methods o a public static method named run that takes no parameter and return a boolean value: true for pass and false for fail. o the run method first shows information on the criteria of passing the training, then prompts the user to input two double data: the velocity and the angle in degree; o the run method then calls the three methods in JumpingCalculator class, to calculate and display the jumping distance, jumping time, and jumping height; o the run method then decides whether the user passes the training or not, by checking if the jumping distance is within the specific range (between 95.0 and 105.0 in this case). if the user passed the training, then terminates the method and returns true; if the user failed the training, then asks the user if he would exit or continue. if the user chooses to continue, then read the users input again; if the user chooses to exit, then terminate the method and return false. TrainProgLoader Class This class creates trainees and loads the JumpingTraining class. Fields o a public static final int data field named SIZE and is given a value of 3; Methods o the main method that does the following: creates a Trainee array containing a number of SIZE trainees (in this case 3 trainees); create the three members of the Trainee array, with id 1, 2, 3, and name Neo, Morpheus, and Trinity; call the currentTrainee method to obtain users choice of the id of current trainee; if the user is a valid trainee (id exists), say hello to him, then load the jumping training program by calling the JumpingTraining classs run method; assign jumping training result (true=pass, false=fail) to the trainee by calling the trainees setjumpTrain method; print the latest information of the trainee by calling the trainees printInfo method. o a public static method named currentTrainee that takes a Trainee array as the parameter; shows the number of trainees by calling Trainees getNumOfTrainee method; shows each trainees information by calling the trainees printInfo method; asks the user to choose who he is, by giving the id number; if the users input is valid (id exists), then return the id number as an int value; if the users input is invalid, then ask the user to choose again;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started