程序代写代做代考 graph Java Department of Computer Science and Information Technology La Trobe University

Department of Computer Science and Information Technology La Trobe University
CSE1OOF/4OOF Term 5 Assignment Part B
Due Date: Monday, 12th October 2020, at 10.00 a.m.
First and Final date for SUBMISSION Monday 12th October 2020 at 10.00 am
Delays caused by computer downtime cannot be accepted as a valid reason for a late submission. Students must plan their work to allow for both scheduled and unscheduled downtime. There are no days late or extensions on this assignment as execution test marking will begin in Week 5 lab. This is an individual assignment. You are not permitted to work as a group when writing this assignment.
Copying, Plagiarism: Plagiarism is the submission of somebody else’s work in a manner that gives the impression that the work is your own. The Department of Computer Science and Information Technology treats academic misconduct seriously. When it is detected, penalties are strictly imposed. Refer to the unit guide for further information and strategies you can use to avoid a charge of academic misconduct. All submissions will be electronically checked for plagiarism.
Assessment Objectives:
 to design programs that conform to given specifications
 to practise combining multiple classes and methods into a whole program
 to implement programs in Java.
Submission Details: Full instructions on how to submit electronic copies of your source code files from your latcs8 account are given at the end. If you have not been able to complete a program that compiles and executes containing all functionality, then you should submit a program that compiles and executes with as much functionality as you have completed. (You may comment out code that does not compile.)
Note you must submit electronic copies of your source code files using the submit command on latcs8. Ensure you submit all required files, one file at a time. For example, the file Rocket.java would be submitted with the command:
> submit OOFT5A2 Astornaut.java
PLEASE NOTE: While you are free to develop the code for this progress check on any operating system, your solution must run on the latcs8 system.
Marking Scheme: This assignment is worth 15% of your final mark in this subject. Implementation (Execution of code) 90%, explanation of code 10%
You may be required to attend a viva voce (verbal) assessment (to be used as a weighting factor on the final mark).
Do NOT use the LMS to submit your files, use latcs8 only
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date Page 1 of 21

Return of Mark sheets:
The face to face execution test marking in the lab (Week 5) constitutes a return of the assignment mark,
subject to the conditions given below.
Please note carefully:
The submit server will close at 10:00 am on October 12th
After the submit server has closed, NO assignments can be accepted.
Please make sure that you have submitted all your assignment files before the submit server closes. (see pages 11 – 12)
There can be NO extensions or exceptions.
Your assignment will be marked in your normal lab, starting??
You must attend your assigned lab (the lab you have signed up for on the LMS page). Non-attendance will result in your assignment being awarded 0, as will attending a lab that is not your assigned lab, without prior notification, as detailed below.
If you cannot attend your assigned lab, please contact your teaching team to arrange another time.
Marking scheme:
90% for the code executing correctly
10%, you will be asked to explain (and / or alter) parts of your code.
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date Page 2 of 21

Using code not taught in OOF – READ THIS
Please also note carefully that whilst we encourage innovation and exploring java beyond what has been presented in the subject to date, above all, we encourage understanding.
The assignment that follows can be solved using techniques that have been presented in lectures, lecture / workshops and labs so far.
These are the techniques and knowledge that we will later be examining in the Real Time Test and the exam.
Code and techniques that are outside the material presented will not be examined, of course. You are free to implement the program below in any way, with one condition.
Any assignment that uses code that is outside what has been presented to this point must be fully explained at the marking execution test. Not being able to fully explain code outside what has been presented in the subject so far will result in the assignment being awarded a mark of 0, regardless of the correctness of the program.
Submitting an assignment with code outside what has been presented so far and not attending the marking execution test will result in an automatic mark of 0, regardless of the correctness of the submission.
Access Modifiers in objects
Please note that all object attributes must have private as their access modifier. Any classes that have any non-private object attributes
will result in the whole assignment mark being heavily reduced, up to and including, being awarded 0, regardless of the correctness of the program. This includes omitting access modifiers, which means that the object attributes have the java default access modifier package. This was discussed in lectures.
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date Page 3 of 21

Problem Background
Humankind is pushing out into space. New planets are being discovered and explored with a view to colonizing suitable planets.
The agency tasked with this somewhat momentous job is to reach Mars and explore it.
Mars can be reached by using a newly designed MarsVehicle which consists of two Rockets
and to explore the planet first time an Astronaut is sent in each Rocket.
When an Astronaut first joins the expedition to MARS, they have not been part of any
expeditions, their Expertise level is Beginner.
As an Astronaut member carries out more expeditions, their Expertise level increases.
If the Astronaut has been on between 0 and 3 expeditions (inclusive), then their Expertise level is Beginner
If the Astronaut has been on between 3 and 8 expeditions (inclusive), then their Expertise level is Intermediate
If the Astronaut has been on 9, or more, expeditions, then their Expertise level is Specialist
To start an expedition, firstly, there must be a Rocket which must have an Astronaut and not be on an expedition.
Secondly, the Expertise level required for the expedition must be within the Expertise level of the Astronaut. An Astronaut with a higher Expertise level can undertake an expedition that requires a lesser Expertise level, but an Astronaut cannot undertake an expedition that requires a higher Expertise level.
The Astronaut must have the required Expertise level before being assigned the expedition.
Each time an Astronaut finishes an expedition, the number of expeditions they have been on is incremented by one. The program must then check if the Astronaut has accumulated enough expeditions to move to the next Expertise level.
To end an expedition, the Rocket must be on an expedition.
Program Requirements
You have been asked to write an interactive program, in Java, to aid in monitoring and maintaining all aspects of MarsVehicle prepared for MARS.
This program is a prototype and there will be only 2 Rocket objects in the program. If the prototype proves successful, this will be expanded in the next iteration (The Progress Check Test assignment)
Recall that a Rocket object also has an associated Astronaut object (when the Astronaut object is assigned).
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date Page 4 of 21

To aid in the rapid development of this program, 3 Java files are provided for you: Astronaut.java, Rocket.java, MarsVehicle.java
These files are zipped (Supporting files.zip) and available with this assignment document for you to download and place it in your current directory.
Astronaut.java
All Astronaut objects have the following object attributes:
• name
• id
• expeditions
• Weight
• Expertise
This a String (text) and is the name of the Astronaut, may be more than one word
This a String (text) and is the unique id of the Astronaut, may be more than one word
This is an integer and is the number of expeditions that the Astronaut has participated in. (See the explanation below) This is a double representing the weight of Astronaut. It is an important factor for starting an expedition.
This is a String and is one of the three Expertise levels,
as described above. The Expertise level is always based on the number of expeditions that the Astronaut has participated in, and must be set by the program.
The user must NEVER be able to enter the Expertise level, nor is it ever stored in a file.
The Expertise level is also known as the task level. Any references to task level in this document are the same as Expertise level.
The Astronaut class requires the following functionality:
A constructor that takes name, Astronaut id and weight as parameters. This is the
constructor that is called when a new Astronaut is added.
Recall that it is the number of expeditions that determines the Expertise level, so there must be a way for the constructor to set the Expertise level. Initially, the number of expeditions must be set to 0 as the Astronaut has just been created.
This is where you write a private helper method in the Astronaut class, like the setCategory method in lab 7
The Astronaut class also requires accessor methods (get and set) as you deem appropriate.
The Astronaut class also requires a method to increment the number of expeditions. Calling this method adds another expedition to the total number of expeditions. This method should then check whether that moves the Astronaut to the next Expertise level.
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date Page 5 of 21

Finally, the Astronaut class requires a toString method which returns a String with information about the Astronaut object, see at the end for the format of the String to be returned.
Please note that the output must follow the format exactly, this will be assigned marks in the execution test.
Rocket.java
The Rocket class has the following attributes:
• Rocketid ThisisaString(text)andmayconsistofmorethanoneword The Rocket id is the unique identifier for a Rocket.
• onexpedition Thisisabooleanvariable,thevaluefalseindicatesthatthe Rocket is NOT on an expedition. The value true indicates that the
Rocket is on an expedition.
• payload ThisisanintvalueinKGswhichrepresenthowmuchpayloadissent
in Rocket.
• weightCapacityThisisadoublevariable,whichrepresentthathowmuchinKGsa
rocket can carry.
• Astronaut ThisistheAstronautclassobjectreferencefortheAstronaut object that is associated with this Rocket (when the Astronaut
object is added and instantiated)
The constructor of this class takes Rocket id, payload and weightCapacity as parameters for a Rocket object. This constructor is called when user wants to add a Rocket object. The Rocket cannot be on an expedition as it has just been created and, for the same reason, it does not have an Astronaut object associated with it.
The Rocket class must never have an Astronaut object reference as a parameter in any of its methods, including the constructor(s). The Rocket class requires a method to add an Astronaut to the Rocket. This method takes all of the relevant parameters for instantiating an Astronaut object (but doesn’t pass in an Astronaut object reference). The resultant object is stored in the Astronaut object reference. Each Rocket can have only one Astronaut. When adding, the program needs to check that the Rocket object does not already have an Astronaut object.
The Rocket class will require accessor methods as you deem appropriate.
The Rocket class also requires a toString method that returns a String with information about the state of that Rocket object. The format of the String is shown in the example outputs. As with the Astronaut screen output, you must follow the format shown exactly, marks will be assigned to following the format.
The Rocket also needs methods to start and end an expedition. Recall that when all the conditions are met, an expedition is assigned to a Rocket. Starting an expedition sets the on expedition attribute of the Rocket to true and ending an expedition sets this attribute to
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date Page 6 of 21

false. When that expedition is ended, then the number of expeditions for the associated Astronaut must be incremented
The Expertise level attribute is private to the Astronaut class, so it cannot be called directly from the Rocket class. All interactions (message passing) between the Rocket and Astronaut classes must be through the public methods of the Astronaut class.
If the Expertise level attribute can be set directly from the Rocket class, or any other attributes of the Astronaut class can be directly access from the Rocket class, the whole assignment will be awarded 0, regardless of the functionality of the program.
The Rocket class could also use a method that takes the required Expertise level of the expedition as a parameter and returns true or false as to whether the associated Astronaut has the required Expertise level. Note that this is could also be done in the main driver class, MarsVehicle, which is described below.
You might find it useful to write a method in the Rocket class that returns a boolean to indicate if the Rocket already has an Astronaut or not, and another one to indicate if the Rocket is on an expedition or not.
The Astronaut and Rocket classes do NOT ask the user for any input, either keyboard or file. There must not be any input objects in these classes such as Scanner or BufferedReader but not limited to these 2. Another way of saying this is that these classes are not interactive.
Note: MarsVehicle class must NOT have Astronaut object attribute(s) or Astronaut object references. All interactions involving an Astronaut will be through the relevant Rocket object.
The driver program, MarsVehicle.java starts by presenting the user with a menu, as follows:
MARS Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >>
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date
Page 7 of 21

Implement the functionality of each menu choice as follows (assume user input is always an integer):
1. Display
This menu choice displays the contents of the non-null Rocket object references to the screen. The format is shown in the sample run of the program. If both Rocket object references are null
then an appropriate message is displayed to the screen.
Calling this menu choice must not result in the program crashing (for example, NullPointerException)
2. Add Rocket
This menu option is chosen when the user attempts to add a Rocket object from the keyboard. If both of the Rocket object references Rocket1 and Rocket2 already have Rocket objects, then the user is informed via a message to the screen and the program returns to the main menu without asking the user for any information.
If at least one of the Rocket objects references does not have a Rocket object, then the user is asked to enter the id of a Rocket.
The program must check that this Rocket id is not already assigned to a Rocket. If the Rocket id is already assigned to another Rocket, the user is informed via a message to the screen and the program returns to the main menu. If the user entered Rocket id is unique, then the user is asked to enter the payload and weightCapacity of Rocket and appropriate Rocket constructor is called and a new Rocket object is instantiated.
NO Astronaut information is entered in this menu choice.
If both Rocket object references are free (do not have Rocket objects attached to them), then Rocket1 is always used first. If Rocket1 is not free, then Rocket2 is used.
How can you tell if a Rocket object reference is “free”, that is, does not have a Rocket object attached? We have studied this
Regardless of the action taken in this menu choice, the program returns to the main menu when this menu choice is completed.
3. Add Astronaut
This menu choice adds an Astronaut to a Rocket, using information from the keyboard. First, of course, the program must check that there is actually a Rocket to which we can add an Astronaut, If there are no Rocket’s (that is, there are no Rocket objects), then the user is informed with a message to the screen and the program returns to the main menu. The user is not asked for any further information.
If there is at least one Rocket object, then the user is asked for the id of a Rocket. The program tries to find the Rocket with this Rocket id.
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date Page 8 of 21

If the Rocket with the user entered Rocket id is found, then there is one further check. This is to check that that Rocket does not already have an Astronaut object. Recall that there can only be one Astronaut object in a Rocket object. If there is already an Astronaut object, then the user is informed via a message to the screen, no further information is asked from the user, and the program returns to the main menu.
If the Rocket with the user entered Rocket id is found and it does not have an Astronaut object, then the user is asked to enter the id of an Astronaut. There is one final check:
The program must check that this user entered Astronaut id is not already in use. If the user entered Astronaut id is already in use, then the user is informed via a message to the
screen, no further information is requested from the user, and the program returns to the main menu.
If the program gets to this point, then there is a Rocket object with the user entered Rocket id and the user entered Astronaut id is unique. The user is then asked to enter the name and weight of the Astronaut and the Astronaut object is added to that Rocket object. (The number of expeditions must be 0, as we have just instantiated the Astronaut and the Expertise level is worked out by the Astronaut constructor, based on the number of expeditions).
If there is not a Rocket with the user entered Rocket id, then a message is displayed to the screen and the program returns to the main menu, without asking for any more information.
3. Start Expedition
This menu choice first checks that there is at least one non-null Rocket object reference. If both Rocket object references are null, then an appropriate message is displayed to the screen and the program returns to the main menu. If there is at least one non-null Rocket object reference, then the user is prompted (asked) for the id of a Rocket.
The program must then try to find the Rocket that contains the Rocket object with this Rocket id. This could be the first Rocket object or the second Rocket object (if it exists). If the Rocket id is not found, then an appropriate message is displayed to the screen and the program returns to the main menu.If the Rocket id is found, then the program must check that this Rocket is available for an expedition.
To be available for an expedition, the Rocket must not on an expedition (working) and the Rocket must have an Astronaut. That is, the Astronaut object reference in the Rocket object in which the Rocket with the user entered Rocket id was found, must have an Astronaut object attached to it. If Rocket has an Astronaut, then it is also required to check if the total weight (payload + Astronaut weight) is below or equal to the weightCapacity of the Rocket.
If the Rocket is not available for an expedition, then an appropriate message is displayed to the screen and the program returns to the main menu.
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date Page 9 of 21

After passing the checks above, the user is asked to enter the required Expertise level of the expedition. If the Astronaut has the required Expertise level, then and only then, is the Rocket assigned that expedition.
If the Rocket can be assigned an expedition, the on expedition attribute of the Rocket is set to true, indicating that the Rocket is on an expedition.
The program always returns to the main menu at the end of the menu choice, regardless of the action taken or not taken.
4. End Expedition
This menu choice prompts (asks) the user for the id of a Rocket, after making the same checks
as in Start Expedition, that is, there is actually at least one non-null Rocket object reference.
As with Start Expedition appropriate messages should be displayed to the screen if the Rocket with the user entered Rocket id is not found, there are no non-null Rocket object references or if the Rocket id is found but that Rocket is not already on an expedition. (You can’t end an expedition unless the Rocket is currently on an expedition.)
If any of the above are true, then the program returns to the main menu.
If the Rocket with the user entered Rocket id exists and the Rocket is on an expedition, then the appropriate changes are made to the Rocket and its associated Astronaut object. The on expedition attribute of Rocket is set to false, indicating that the Rocket is not on an expedition, Also, the number of expeditions worked by the Astronaut is incremented by one(do not forget to check whether this crosses one of the boundaries of the Expertise levels, resulting in a change in Expertise level)
After the conclusion of any and all actions in this menu choice, the program returns to the main menu.
7. Exit the program
This menu choice closes the program.
Electronic Submission of the Source Code
• Submit all the Java files that you have developed in the expeditions above.
• The code has to run under Unix on the latcs8 machine.
• You submit your files from your latcs8 account. Make sure you are in the same directory as the files
you are submitting. Submit each file separately using the submit command.
submit OOF Astronaut.java
submit OOF Rocket.java
submit OOF MarsVehicle.java
After submitting the files, you can run the following command that lists the files submitted from your account:
verify
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date Page 10 of 21

You can submit the same filename as many times as you like before the assignment deadline; the previously submitted copy will be replaced by the latest one.
Note: in the above requirements, where it talks about Rocket id’s and Astronaut id’s being unique, this applies on a case insensitive basis.
That is, A 10 N23 and a 10 n23 are to be treated as exactly the same id.
Please make sure that you have read page 2 about the submission close off date and time and the compulsory requirement to attend the execution test during Week 10
Failure to do both of these things will result in your assignment be awarded a mark of 0, regardless of the correctness of the program.
Execution test marks are provisional and subject to final plagiarism checks and checks on the compliance of your code to this assignment document.
As such final assignment marks may be lower or withdrawn completely.
Example run of the program (NOTE not all functionality and error checks/messages are shown) user input in bold
> java MarsVehicle
Mars Planetary Explorer Main menu
1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 1
There are no Rockets to display
Add at one least one Rocket
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 3
There are no Rockets!
Cannot add Astronauts until there is at least one Rocket
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 4
Cannot start expedition as there are no Rockets.
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date
Page 11 of 21

Add at least one Rocket
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 5
Cannot end expedition as there are no Rockets.
Add at least one Rocket
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 2
Enter Rocket id >> r1
Enter Rocket Payload (in KG) >> 100
Enter Rocket Capacity (in KG) >> 200
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 1
Here are the Rocket details
Rocket [
Id: r1
Expedition Status: Not on Expedition Total Weight: 100
Weight Capacity: 200.0
Astronaut: Not yet assigned
]
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 4
Enter Rocket id >> r1
This rocket does not have a Astronaut so cannot start a expedition
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date Page 12 of 21

4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 5
Enter Rocket id >> r1
The rocket with id r1 is
Mars Planetary Explorer
1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 3
Enter Rocket Id >> r1
Enter Astronaut Id >> a1
Enter name >> Ria
Enter Weight >> 65
Mars Planetary Explorer
1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 1
not on a expedition, so cannot end expedition Main menu
Here are the Rocket details
Rocket [
Id: r1
Expedition Status: Not on Expedition
Total Weight: 165
Weight Capacity: 200.0
Astronaut: Astronaut [
name: Ria
id: a1
Expeditions: 0
Expertise: Beginner
Weight: 65
] ]
Mars Planetary Explorer
1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 5
Enter Rocket id >> r1
The rocket with id r1 is
Mars Planetary Explorer
1. Display
2. Add Rocket
Main menu
not on a expedition, so cannot end expedition Main menu
Main menu
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date Page 13 of 21

3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 4
Enter Rocket id >> r1
Enter required skill level >> Beginner
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 1
Here are the Rocket details
Rocket [
Id: r1
Expedition Status: On Expedition Total Weight: 165
Weight Capacity: 200.0 Astronaut: Astronaut [
name: Ria
id: a1
Expeditions: 0
Expertise: Beginner
Weight: 65
] ]
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 5
Enter Rocket id >> r1
Expedition ended
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 1
Here are the Rocket details
Rocket [
Id: r1
Expedition Status: Not on Expedition
Total Weight: 165
Weight Capacity: 200.0
Astronaut: Astronaut [
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date
Page 14 of 21

name: Ria
id: a1
Expeditions: 1
Expertise: Beginner
Weight: 65
] ]
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 2
Enter Rocket id >> r1
The requested rocket id is already in use. Rocket id’s must be unique. Rerun the menu choice with valid rocket id
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 2
Enter Rocket id >> r2
Enter Rocket Payload (in KG) >> 80
Enter Rocket Capacity (in KG) >> 190
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 1
Here are the Rocket details
Rocket [
Id: r1
Expedition Status: Not on Expedition
Total Weight: 165
Weight Capacity: 200.0
Astronaut: Astronaut [
name: Ria
id: a1
Expeditions: 1
Expertise: Beginner
Weight: 65
]
]
Rocket [
Id: r2
Expedition Status: Not on Expedition
Total Weight: 80
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date
Page 15 of 21

Weight Capacity: 190.0
Astronaut: Not yet assigned ]
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 3
Enter Rocket Id >> r2
Enter Astronaut Id >> a1
This Astronaut’s Id is already in use.
Astronaut’s Id must be unique
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 3
Enter Rocket Id >> r2
Enter Astronaut Id >> a2
Enter name >> xyz
Enter Weight >> 120
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition 5. End Expedition
6. Close the program
Enter choice >> 1
Here are the Rocket details
Rocket [
Id: r1
Expedition Status: Not on Expedition
Total Weight: 165
Weight Capacity: 200.0
Astronaut: Astronaut [
name: Ria
id: a1
Expeditions: 1
Expertise: Beginner
Weight: 65
]
]
Rocket [
Id: r2
Expedition Status: Not on Expedition
Total Weight: 200
Weight Capacity: 190.0
Astronaut: Astronaut [
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date
Page 16 of 21

name: xyz
id: a2
Expeditions: 0
Expertise: Beginner
Weight: 120
] ]
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 4
Enter Rocket id >> r2
The total weight of rocket exceeds the weight capacity so cannot send on expedition
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 4
Enter Rocket id >> r1
Enter required skill level >> Beginner
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 5
Enter Rocket id >> r1
Expedition ended
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 1
Here are the Rocket details
Rocket [
Id: r1
Expedition Status: Not on Expedition
Total Weight: 165
Weight Capacity: 200.0
Astronaut: Astronaut [
name: Ria
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date
Page 17 of 21

id: a1
Expeditions: 2
Expertise: Beginner
Weight: 65
]
]
Rocket [
Id: r2
Expedition Status: Not on Expedition
Total Weight: 200
Weight Capacity: 190.0
Astronaut: Astronaut [
name: xyz
id: a2
Expeditions: 0
Expertise: Beginner
Weight: 120
] ]
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 4
Enter Rocket id >> r1
Enter required skill level >> Beginner
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 5
Enter Rocket id >> r1
Expedition ended
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 1
Here are the Rocket details
Rocket [
Id: r1
Expedition Status: Not on Expedition
Total Weight: 165
Weight Capacity: 200.0
Astronaut: Astronaut [
name: Ria
id: a1
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date
Page 18 of 21

Expeditions: 3
Expertise: Beginner
Weight: 65
]
]
Rocket [
Id: r2
Expedition Status: Not on Expedition
Total Weight: 200
Weight Capacity: 190.0
Astronaut: Astronaut [
name: xyz
id: a2
Expeditions: 0
Expertise: Beginner
Weight: 120
] ]
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 4
Enter Rocket id >> r1
Enter required skill level >> Beginner
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 5
Enter Rocket id >> r1
Expedition ended
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 1
Here are the Rocket details
Rocket [
Id: r1
Expedition Status: Not on Expedition
Total Weight: 165
Weight Capacity: 200.0
Astronaut: Astronaut [
name: Ria
id: a1
Expeditions: 4
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date
Page 19 of 21

Expertise: Intermediate
Weight: 65 ]
]
Rocket [
Id: r2
Expedition Status: Not on Expedition
Total Weight: 200
Weight Capacity: 190.0
Astronaut: Astronaut [
name: xyz
id: a2
Expeditions: 0
Expertise: Beginner
Weight: 120
] ]
Mars Planetary Explorer Main menu 1. Display
2. Add Rocket
3. Add Astronaut
4. Start Expedition
5. End Expedition
6. Close the program
Enter choice >> 6
Process finished with exit code 0
How the assignment is marked
Please note that the assignment is marked, face to face, in your lab. You are required to run your program. This means that you need to have code that compiles, runs and displays to the screen. Code that does not compile will achieve a mark of 0. We cannot award marks for non-compiling, non-running or non- displaying code, that is, look through your code and award marks on what might have happened if you could have gotten your code to run and/or display.
It is essential that your code displays to the screen the outcome of the actions that you have coded. Without this display, we have no way of checking that your assignment is in fact meeting the requirements. Please refer to the paragraph above.
The smallest amount of code that compiles, runs and displays an outcome will get more marks than a whole assignment that does not compile, does not run or does not display anything to the screen.
Final Notes: – transferring files between Windows and Unix
Be very careful transferring files from Windows to Unix. If you do transfer a file from Windows to Unix open the file, in Unix, using vi.
For example, if you transferred a file named b.txt from Windows to Unix open the file in Unix with the command
vi –b b.txt
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date Page 20 of 21

you will (might) see a lot of ^M’s at the end of each line.
These MUST be removed using the command shown below or else your input file will have too many newline characters and will not translate properly. That is, your code will not correctly read the input file(s).
Your code will work on Windows but NOT on Unix.
Still in vi, in command mode (press the Esc key first) do the following
:%s/ctrl-v ctrl-m//g
ctrl-v ctrl-m means hold down the control key and with the control key down press v then
press m.
Final, final notes
Don’t let anyone look at your code and definitely don’t give anyone a copy of your code. The plagiarism checker will pick up that the assignments are the same and you will both get 0 (it doesn’t matter if you can explain all your code).
There will be consultation sessions for the assignment, the times will be posted on LMS. If you have problems come to consultation.
And a final, final, final note, “eat the dragon in little bits”. Do a little bit every night; before you know it you will be finished. The assignment is marked with running code, so you are better to have 2 or 3 parts completed that actually compile and run, rather than a whole lot of code that doesn’t compile.
The execution test is done on latcs8 so please make sure that your code runs on latcs8 before you submit.
OOF Assignment Part B – due: 10:00 am Monday 12th October this is the first and final hand in date Page 21 of 21