Question: Create a class called Player that includes two pieces of information as instance variablesa name (type String) and a salary (type double); should have a

 Create a class called Player that includes two pieces of information

Create a class called Player that includes two pieces of information as instance variablesa name (type String) and a salary (type double); should have a constructor that initializes the two instance variables (if the salary is a negative number, set it to default value of 0.0); should have a set and a get method for each instance variable (if the salary is a negative number, set it to default value of 0.0); include a method getPromotion() which increases the player's salary by 10%. (Do not provide any inputs in class Player.) . Then write a test class named PlayerTest that demonstrates class Player's profiles. In the test class, you need to test in the following order: prompt the inputs the name and salary (a negative number); create an object of Player with using Player constructor with the 2 input values; display the display the player's profiles with using printf() (through calling the get methods on the player object); change the player's salary with using setSalary method (with a new input); display the player's profiles with using printf() (through calling the get methods on the player object); apply getPromotion() method on the player; display the player's profiles with using printf(" (through calling the get methods on the player object)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!