ParticipantMaximum Score: 17 pts (see red text for point bre

ParticipantMaximum Score: 17 pts (see red text for point breakdown)In this assignment you will create a class named Participant. Then you will test your classwith a tester application we provide. You should read the descriptions of the Participant classmethods below, but then open and read the tester application’s main method in detail beforeyou write them. The tester application will help you understand how your methods will be used.Create a file named Participant.java in your PSA8 directory. Your Participant class will have thefollowing features.1. Instance Variables (3 pts) name: The name of the participant; this should be a String. weight: The weight (lb) of the participant; this should be an int. height: The height (ft) of the participant; this should be a double.2. Constructors (3 pts) Your Participant class should have three constructors. The first constructor should take in no parameters and set the instance variables tothe following default values.o name: ‘Joe Schmoe’o weight: 200o height: 6.0 The second constructor should take in only one parameter, a String to which to setthe name. The other two instance variables should be set to default values listedabove. The third constructor should take an appropriate number of parameters to set everyinstance variable. If weight or height is negative, this constructor should not set thevariable to this negative value; instead it should print the following and set the valueto the default value listed above:’Incorrect height, height must be positive. Height will be set to default value (6.0).’OR’Incorrect weight, weight must be positive. Weight will be set to default value(200).’3. Methods (3 pts) For every instance variable, you will create a getter and a setter.o The getter will return the current value of that instance variable.o The setter will take a parameter and set the instance variable to that value.Note that if height or weight is negative, you should not update the value.Instead, you should print the following message:’Incorrect height, height must be positive. Height will not be updated.’OR’Incorrect weight, weight must be positive. Weight will not be updated.’ Create a method named toString that takes no parameters and returns a String.The toString output should match the output the tester provides. Finally, create a getBMI method that calculates and returns the Body Mass Index(BMI) or the participant. The formula for calculating BMI is: = h ×703h h 2Testing the Participant Class:For this assignment, you MUST use our tester application. Incorrect execution of the testerapplication will result in a potentially low grade. Download ParticipantTester.java from Blackboard and save it in your PSA8 directory. Wehighly recommend you review the testing application prior to starting the assignment: itwill help you understand what is required of you. Please note: This tester does NOT test for all possible failure conditions and represents abasic testing method. More extensive automated testing is often applied in industry.  The output should EXACTLY match the output shown in PSA8-correct-output.txt (6 pts). Note: If your implementation is incorrect, the tester will help you determine why. Youcan use the tester to determine default values, and mistakes you may have made.Comments: Comments in the style detailed in the book ARE required. Your code must be properlycommented to receive full credit (2 pts). /** * ParticipantTester.java * * A class that tests the correctness of a Participant class. * * @author Sat Garcia */public class ParticipantTester{ private static int numPassed = 0; private static int numFailed = 0; private static int testNumber = 0; private static final String defaultName = ‘Joe Schmoe’; private static final int defaultWeight = 200; private static final double defaultHeight = 6.0; private static final double defaultBMI = 3905.5555555555557; /** * Method to test default constructor, using getters to retrieve fields. */ public static void testDefaultConstructor() { System.out.println(‘Creating a default participantn’); Participant participant = new Participant(); System.out.println(‘Test #’ + testNumber++ + ‘: Testing correct default name using the getName methodn’); if(participant.getName().equals(defaultName)) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant.getName() + ‘ is incorrect, the default name should be ‘ + defaultName + ‘n’); numFailed++; } System.out.println(‘Test #’ + testNumber++ + ‘: Testing correct default weight using the getWeight methodn’); if(participant.getWeight() == defaultWeight) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant.getWeight() + ‘ is incorrect, the default weight should be defaultWeightn’); numFailed++; } System.out.println(‘Test #’ + testNumber++ + ‘: Testing correct default height using the getHeight methodn’); if(participant.getHeight() == defaultHeight) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant.getHeight() + ‘ is incorrect, the default height should be ‘ + defaultHeight + ‘n’); numFailed++; } System.out.println(‘Test #’ + testNumber++ + ‘: Testing the getBMI method on the first participantn’); if(participant.getBMI() == defaultBMI) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant.getBMI() + ‘ is incorrect, the default BMI should be ‘ + defaultBMI + ‘n’); numFailed++; } } /** * Method to test the participant’s ‘setter’ methods. */ public static void testSetters() { System.out.println(‘Test #’ + testNumber++ + ‘: Testing each set method using a default participantn’); Participant participant = new Participant(); participant.setName(‘Sally Jane’); System.out.println(‘Test #’ + testNumber++ + ‘: Testing setName(‘Sally Jane’) method using the getName methodn’); if(participant.getName().equals(‘Sally Jane’)) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant.getName() + ‘ is incorrect, the updated name should be Sally Janen’); numFailed++; } participant.setWeight(100); System.out.println(‘Test #’ + testNumber++ + ‘: Testing setWeight(100) method using the getWeight methodn’); if(participant.getWeight() == 100) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant.getWeight() + ‘ is incorrect, the updated weight should be 100n’); numFailed++; } participant.setHeight(5.0); System.out.println(‘Test #’ + testNumber++ + ‘: Testing setHeight(5.0) using the getHeight methodn’); if(participant.getHeight() == 5.0) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant.getHeight() + ‘ is incorrect, the updated height should be 5.0n’); numFailed++; } System.out.println(‘Test #’ + testNumber++ + ‘: Testing the getBMI method on the first participant after changing weight and heightn’); if(participant.getBMI() == 2812.0) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘+participant.getBMI() +’ is incorrect, the default BMI should be 2812.0n’); numFailed++; } } /** * Method to test the single argument Participant constructor, which takes * in only the name of the participant. */ public static void testSingleParamConstructor() { System.out.println(‘Creating a new participant using the single parameter constructorn’); Participant participant2 = new Participant(‘Sean Connery’); System.out.println(‘Test #’ + testNumber++ + ‘: Testing correct name using the getName methodn’); if(participant2.getName().equals(‘Sean Connery’)) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant2.getName() + ‘ is incorrect, the name should be Sean Conneryn’); numFailed++; } System.out.println(‘Test #’ + testNumber++ + ‘: Testing correct default weight using the getWeight methodn’); if(participant2.getWeight() == defaultWeight) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant2.getWeight() + ‘ is incorrect, the default weight should be ‘ + defaultWeight + ‘n’); numFailed++; } System.out.println(‘Test #’ + testNumber++ + ‘: Testing correct default height using the getHeight methodn’); if(participant2.getHeight() == defaultHeight) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant2.getHeight() + ‘ is incorrect, the default height should be ‘ + defaultHeight + ‘n’); numFailed++; } System.out.println(‘Test #’ + testNumber++ + ‘: Testing the getBMI method on the second participantn’); if(participant2.getBMI() == defaultBMI) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant2.getBMI() + ‘ is incorrect, the default BMI should be ‘ + defaultBMI + ‘n’); numFailed++; } } /** * Method to test the three argument Participant constructor, which takes * in the name, height, and weight of the participant. */ public static void testThreeParamConstructor() { System.out.println(‘Creating a new participantn’); Participant participant3 = new Participant(‘Alex Baldwin’, 150, 5.0); System.out.println(‘Test #’ + testNumber++ + ‘: Testing correct name using the getName methodn’); if(participant3.getName().equals(‘Alex Baldwin’)) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant3.getName() + ‘ is incorrect, the name should be Alex Baldwinn’); numFailed++; } System.out.println(‘Test #’ + testNumber++ + ‘: Testing correct weight using the getWeight methodn’); if(participant3.getWeight() == 150) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant3.getWeight() + ‘ is incorrect, the weight should be 150n’); numFailed++; } System.out.println(‘Test #’ + testNumber++ + ‘: Testing correct height using the getHeight methodn’); if(participant3.getHeight() == 5.0) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant3.getHeight() + ‘ is incorrect, the height should be 5.0n’); numFailed++; } System.out.println(‘Test #’ + testNumber++ + ‘: Testing the getBMI method on the third participantn’); if(participant3.getBMI() == 4218.0) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant3.getBMI() + ‘ is incorrect, the default BMI should be 4218.0n’); numFailed++; } System.out.println(‘Test #’ + testNumber++ + ‘: Testing the toString methodn’); if(participant3.toString().equals(‘Participant:nName: Alex BaldwinnWeight: 150nHeight: 5.0n’)) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant3.toString() + ‘nis incorrect, the string should read:nParticipant:nName: Alex BaldwinnWeight: 150nHeight: 5.0n’); numFailed++; } } /** * Method to test setting weight/height to negative values; this will test * negative values in both the three parameter constructor and the setter * methods. */ public static void testNegatives() { System.out.println(‘Test #’ + testNumber++ + ‘: Testing three parameter constructor with negative heightn’); System.out.println(‘Should print ‘Incorrect height, height must be positive. Height will be set to default value (‘ + defaultHeight + ‘).”); Participant participant4 = new Participant(‘Negative Height’, 100, -5.0); System.out.println(); if(participant4.getHeight() == defaultHeight) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant4.getHeight() + ‘ is incorrect, the height should be ‘ + defaultHeight + ‘n’); numFailed++; } System.out.println(‘Test #’ + testNumber++ + ‘: Testing setWeight method with negative weightn’); System.out.println(‘Should print ‘Incorrect weight, weight must be positive. Weight will not be updated.”); System.out.println(); participant4.setWeight(-150); if(participant4.getWeight() == 100) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant4.getWeight() + ‘ is incorrect, the weight should be 100n’); numFailed++; } System.out.println(‘Test #’ + testNumber++ + ‘: Testing three parameter constructor with negative weightn’); System.out.println(‘Should print ‘Incorrect weight, weight must be positive. Weight will be set to default value (‘ + defaultWeight + ‘).”); Participant participant5 = new Participant(‘Negative Weight’, -100, 5.0); System.out.println(); if(participant5.getWeight() == defaultWeight) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant5.getWeight() + ‘ is incorrect, the weight should be ‘ + defaultWeight + ‘n’); numFailed++; } System.out.println(‘Test #’ + testNumber++ + ‘: Testing setHeight method with negative heightn’); System.out.println(‘Should print ‘Incorrect height, height must be positive. Height will not be updated.”); participant5.setHeight(-6.0); System.out.println(); if(participant5.getHeight() == 5.0) { System.out.println(‘tTest PASSED!n’); numPassed++; } else { System.out.println(‘tTest FAILED!n’); System.out.println(‘tReason: ‘ + participant5.getHeight() + ‘ is incorrect, the weight should be 5.0n’); numFailed++; } } public static void main(String [] args) { testDefaultConstructor(); testSetters(); testSingleParamConstructor(); testThreeParamConstructor(); testThreeParamConstructor(); testNegatives(); System.out.println(‘*****************************************************’); System.out.println(‘Final Testing Results:’); System.out.println(‘*****************************************************’); System.out.println(numPassed + ‘ passed, ‘ + numFailed + ‘ failed’); }}