Question: C# Create a class called CrewMember that has the following properties: string Name, string Role, double Salary, double CurrentCash Create a CrewMember constructor that takes

C#

Create a class called CrewMember that has the following properties: string Name, string Role, double Salary, double CurrentCash

Create a CrewMember constructor that takes in four parameters that will initialize the four properties of Name, Role, Salary, and CurrentCash.

In CrewMember create a method called IsPaid() which returns a bool. If the CurrentCash property is greater than or equal to Salary return true. Else, return false.

Create a class called SpaceShuttle that has the following properties: int Fuel, List Team

Create a constructor that takes no parameters. Set fuel to 0.

In the constructor, initialize Team with the following members:

"Gina" whose role is "Captain", and Salary is 10000

"John" whose role is "Navigator" and Salary is 5000

"Diddy" whose role is "Chimp" and Salary is 20

On all crew members, set their CurrentCash to 0.

Create a method within SpaceShuttle called DistributePay(). It will have one parameter, a total amount of pay to distribute to the crew as much as possible. If you run out of money, give the current crew member as much as you can and stop the loop. For each crew member:

If the pay variable has enough money, subtract their salary from pay and add their Salary to CurrentCash.

If there isnt enough money left, assign the current crew member whatever is left in the pay to CurrentCash and end the loop. (Yes, this wouldn't be fair in real life but just embrace that this is a contrived example. Think of it this way whoever is more senior in the crew gets paid first.)

In the SpaceShuttle, create a public method named Launch() that returns a bool. This method will only launch the space shuttle if the following are true:

Fuel is greater than 5.

Team Count is exactly 3.

IsPaid() returns true for each member of the crew.

If all conditions are true, your team can go to space! Return true. Otherwise, return false.

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!