Implement the class Character The role should be “primary” or “secondary” all other values are not acceptable. Consider capital and small letters variance. The gender should be “m” or “M” for male or “f” or “F” for female. The age should be a positive value. The giveRaise method increase the salary of a character by a given percentage with a maximum salary of 10000. The toString method returns a string that describes the character. For example: [Elisabeth Kane, female, 35, primary,4500$]
Implement the class Character
The role should be “primary” or “secondary” all other values are not acceptable. Consider
capital and small letters variance.
The gender should be “m” or “M” for male or “f” or “F” for female.
The age should be a positive value.
The giveRaise method increase the salary of a character by a given percentage with a
maximum salary of 10000.
The toString method returns a string that describes the character. For example:
[Elisabeth Kane, female, 35, primary,4500$]
2) Implement the class Play
A Play can have at most 20 characters.
The real number of characters is registered in nbOfCharacters and is updated automatically
when a new character is added.
AddCharacter method adds a new character to the characters array and updates the
nbOfCharacters value.
The attribute nbPlay keeps track of the number of Plays created.
The toString method returns a string description of the play including name, genre and the
names of all the characters.
Example: [The Opera Crime,Drama,
Characters: Loulou Grill – Boby – Elisabeth Kane]
3) Write an application with a main method that allows you to:
a) Create a play with values given by the user.(name, genre).
b) Add 3 characters of your choice to this play.
c) Display a total number of characters in the play.
d) Display the number of primary characters and the number of secondary characters.
e) Display the total of all salaries of the play characters.
f) Give the second character in this play a raise of 25%.
g) Display all information about the play.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images