Question: You will be creating a java program that will allow a mission controller to constitute the crew for a mission to space. The controller will
You will be creating a java program that will allow a mission controller to constitute the crew for a mission to space. The controller will input information such as the name, weight and position on the crew for each astronaut. If the controller leaves out any information, then you should assign default values as indicated below. Required for this project:Create a class called Astronaut. This is the class that your driver class will use. Your Astronaut class must:Three instance variables: Name, Weight & PositionAllow the designer to enter one of the following for each astronaut:No fields. Default name to TBD weight to and position to Crew.Name only. Default the weight to and the position to Crew.Name and weight. Default the position to Crew.Name, weight and position.Have a constructor to handle each of the cases above.Remember to avoid code duplication HowHave methods to set each of these fields.Note that all variables are private.Print out the details for an astronaut.Create a class called AstronautDriver that will produce the output below.Note that the driver is just exercising the class to show its operation. Well make something more interactive when we learn a few more concepts.Note at the end where check for max astronauts takes place. This must be done via an if statement.As always, your output must match the format shown in the sample session. Make sure you generate blank lines to separate the different sections of output.Sample session:Creating first astronaut with no arguments.Astronaut one info:Name: TBDWeight: Position: Crew Creating second astronaut with name only.Astronaut two info:Name: TogarWeight: Position: Crew Creating third astronaut with name and weight.Astronaut two info:Name: IlanaWeight: Position: Crew Changing astronaut to CommanderName: IlanaWeight: Position: Commander
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
