Cse1oof4oof- to design programs that conform to given


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.
- to practice using arrays of objects.

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.

Problem Background

Flight operations on an aircraft carrier are very complex and potentially dangerous. They involve launching aircraft (take off), monitoring aircraft in flight and recovering aircraft (landing). All phases of these operations need to be carefully coordinated to prevent accidents.

Assignment C explored all aspects of these operations, using just 2 Planes. This proved to be such a success that now it has been decided to scale up the program to handle a full air group of 90 Planes.

Planes can now have more than one Crew, but still must have at least one Crew assigned to the Plane before it can be assigned a mission and the Plane must not already be on a mission. When the Plane is on a mission, it is flying, also known as being airborne. It is not possible to have a Crew without there being a Plane first. It is possible to have a Plane without a Crew.

When a Plane is first created, it is placed (added) on the flight deck of the carrier. This means, of course, that when a Plane is first added, it has no Crew, is not on a mission and is not airborne.

As the Plane (and the assigned Crew) fly more missions, the experience level of the Crew increases. The experience level must case insensitive.

If the Crew has flown less than 5 missions, then their experience level is trainee
If the Crew has flown 5 missions or more, but less than 11 missions, then their experience level is regular
If the Crew has flown 11 missions or more, but less than 25 missions, then their experience level is veteran
If the Crew has flown 25 missions or more, then their experience level is elite

As soon as the Plane (and all associated Crew) are assigned a mission, the number of missions for all the Crew, of that Plane, is incremented by 1 and the Plane takes off successfully and is airborne.

To end a mission, the Plane must first actually be airborne, if this is the case, then the Plane is considered to have landed safely and is no longer airborne.

Further changes from Assignment C

Every time the program goes through one cycle of the main menu, each Plane that is on a mission has the time that it has been on a mission incremented by 1.

Since there now can be Planes with more than one Crew, how a Plane is assigned a mission has changed.

The user is asked to enter the experience level required for the mission. You may assume that the user enters one of the four experience levels that apply to the Crew.

As before the first thing that must occur is that the program must find that Plane with the tail number, as entered by the user and check that the Plane is not already on a mission. If both these conditions are true, then the user enters the required experience level of the mission.

To be assigned the mission, the average experience level of all the Crew in that Plane must be equal to or greater than the experience level of the mission

as entered by the user.

How to determine the required experience level.

If the required experience level of the mission is Trainee, then the Plane can undertake this mission (if the tail number matches and the Plane is not on a mission, of course). This is because the experience level of all the Crew in that Plane must be at least Trainee (the starting level)

If the required experience level of the mission is Elite, then only if every Crew, of that Plane, has the Elite experience level could the Plane be assigned the mission. Even one Crew member below Elite experience level would disqualify the Plane.

If the required experience level was Regular, for example, and there were four Crew members, if that Plane, one at Trainee, two at Regular and one at Veteran, then the average experience level rating of the whole Crew is Regular and the Plane could be assigned the mission.

If the required experience level was Veteran and 3 out 4 of the Crew, of that Plane, were Veterans, but one was Regular, then the average experience level is below the required mission experience level and the Plane could not be assigned the mission. On the other-hand if 3 out 4 of the Crew were Veterans and the other Crew member had an Elite experience level, then that overall average is above Veteran and the Plane could be assigned the mission (assuming all other conditions are met)

How you assign values to the experience levels to come up with this average is up to you.

Program Requirements

You have been asked to write an interactive program, in Java, to aid in monitoring and maintaining all aspects of Flight Operations.

This program expands on the earlier work done in Assignment Part C and now needs to handle 90 Planes. Each Plane can have more than one Crew associated with it.

To aid in the rapid development of this program, 3 Java files and 1 sample input file are provided for you:
Crew.java, Plane.java, Carrier.java and a sample input file a.dat

Copy them from the unit library area into your current directory using:
cp /home/1st/csilib/cse1oof/prog/* .

In order to further speed up the development of this program, some of the files listed above have been partially implemented for you, read the comments in the files and in this document.

Crew.java (almost the same as Assignment Part C) All Crew objects have the following object attributes:

- name This a String (text) and is the name of the Crew, may be more than one word
- role This a String (text) and is the role (job) of the Crew, may be more than one word
- id This is an integer and is the unique id of the Crew
- missions This is an integer and is the number of missions that the Crew has undertaken.
- experience level This is a String and is one of the four levels as described
above. The experience level is always based on the number of missions that the Crew has flown and must be set by the program. The user must NEVER be able to enter the experience level, nor is it ever stored in a file.

The Crew class requires the following functionality:

A constructor that takes name, id, role and missions as parameters. This is the constructor that is called when a new Crew is added from the text file. From the file, all four of these parameters have values.

You might want to consider writing a copy constructor for the Crew. The format of the text file is shown on page 10
Recall that it is the number of missions that determine the experience level, so there has to be a way for the constructor to set the experience level. If this constructor is also used for keyboard input, then the number of missions must be set to 0 as the Crew has just been created.

Alternatively, you could write an overloaded constructor that just takes the first three values (name, role and id) as parameters and assigns 0 to the number of missions.

Either way, the experience level must be set by the constructor, not the user. The Crew class also requires accessor methods as you deem appropriate.
The Crew class also requires a method to increment the number of missions. Calling this method adds 1 to the number of missions, which can change the experience level.

The Crew class requires a toString method which returns a String with information about the Crew object, see page 16 for the format of the String to be returned.

Please note that this time you are free to format the screen output in any way, provided only that the user of the program can easily understand the information being displayed.

This is Carrier Air Group operations after all, the users need to be able to take in the information at a glance, not spend time trying to decipher poorly formatted output.
Planes don't stop in the air while the user tries to read information.

The one addition to the functionality of this Crew class that you might (optional, not have to) consider is a method that can be called to write all of the Crew information to a text file.

There are other ways of doing this, this is not the only way and is NOT the "right" answer.

Plane.java (some major changes)

The Plane class has the following attributes:

- name This is a String (text) and is name of the Plane, may consist of more than one word
- model This is a String and is the model of the Plane, may be more than one word
- flying This is a boolean variable, the value false indicates that the Plane is not flying (airborne) which means that the Plane is NOT on a mission. The value true indicates that the Plane is airborne and so is on a mission

- tail number This is a String (text) and may consist of more than one word The tail number is the unique identifier for a Plane

- crew This is now an array of Crew class object references for the Crew objects associated with this Plane (when the Crew objects are added and instantiated)

- max crew This is the maximum number of Crew that can be in this Plane. This is set by the user when the Plane object is created

- current crew This is the current number of Crew actually in the Plane, starts at 0 when the Plane is instantiated

- mission time This is the number of "turns" (through the main menu) the Plane has been on a mission. The mission time is reset to 0 when the Plane ends a mission.

Attachment:- Assignment.rar

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Cse1oof4oof- to design programs that conform to given
Reference No:- TGS01631950

Expected delivery within 24 Hours