Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
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