Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions

Question

Describe the Indian constitution and political system.

Answered: 1 week ago

Question

Explain in detail the developing and developed economy of India

Answered: 1 week ago

Question

Problem: Evaluate the integral: I = X 52+7 - 1)(x+2) dx

Answered: 1 week ago

Question

What is gravity?

Answered: 1 week ago

Question

What is the Big Bang Theory?

Answered: 1 week ago