Determine the required experience level

Assignment Help JAVA Programming
Reference no: EM131243774

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 (20 marks) 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 Week 7 lectures.

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

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.

The Plane class still requires at least 2 overloaded constructors.

One constructor takes all the parameters for a Plane object. This constructor would be used when reading from a text file and we have a Plane record, regardless of any Crew attached to that Plane.

A second, overloaded, constructor for keyboard input for a Plane. This constructor would take just the name, model, tail number and max crew attributes as parameters. Since we have just created the Plane object the value of flying must be false (it cannot be on a mission) and there are no Crew associated with this Plane yet, so the current crew is 0 and the mission time must be 0.

The Plane class will require accessor methods as you deem appropriate.

One of those accessor methods may be a method to return a copy of the crew array. If you decide to write this accessor, remember to take privacy leaks into consideration.

The Plane class also requires a toString method that returns a String with information about the state of that Plane object. The format of the String is shown in the example output on page 16. As with the Crew screen output, this time you are free to format the output anyway you want.

The Plane class requires at least one method to add a Crew to the Plane. This method takes all of the relevant parameters for instantiating a Crew object from the keyboard, that is, name role and id. Using the information in these parameters, instantiate a Crew object which is stored in the crew array, provided that there is a free space. As before, the program first needs to check that the crew id entered by the user is indeed unique.

A second, overloaded method to add a Crew should be considered. This method will take all the information for adding a Crew from the text file. The difference is that, from the file, the number of missions is included, whereas when reading the information from the keyboard, the number of missions is, of course, 0.

There will be a number of mutator methods that you will find you need to write, amongst them, a method to increment the amount of time that a Plane has spent on a mission and a method to increment the number of missions for all the Crew, in that Plane, every time the Plane starts a new mission.

As with the Crew class, you may want to consider a method writing a method that writes the details of the Plane object to a text file. Remember to write the actual number of Crew figure into the text file. This is required so that when we use that output file as an input file, the program knows how many Crew records it needs to read before the next Plane records starts.

As discussed above, the overall experience level of all the Crew, in a Plane, must be greater than or equal to the experience level of the mission as entered by the user. You may want to consider writing a method that takes the user mission experience level as a parameter and returns true or false whether, or not, the overall experience level of the Crew is sufficient for the Plane to be assigned the mission (provided. first, that all the other conditions are met)

The Crew and Plane 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.

The program now starts by asking the user for the name of a text file, see page 10 for the format. This file will contain a number of Plane/Crew records. The filename, will as always, exist and this time will not be empty.

The contents of this file is used to populate the array of Planes. Once the contents of this file have been read into the array of Planes, the file is closed. The only time that a file is opened again is if the user selects the save option.

Where the Plane has a Crew (meaning any number of Crew greater than 0) then you want to call your overloaded addCrew method from the Plane class, the one that takes all the Crew attributes. Use this method to add Crew to the correct Plane.

This results in a change to the menu that is presented to the user. The menu is first presented to the user after the contents of the text file has been read into the array of Planes.

The program must work with any file name entered by the user (of the correct format), that is, the file name must not be hard coded.

An example of the information, in the text file, on each Plane consists of 7 lines. There may be any number of 4 line Crew records after the Plane information. The Plane and Crew information is collectively known as a record:

Implement the functionality of each menu choice as follows (assume user input is always an integer):

1. Add Plane (very much the same as Assignment C)

This menu option is chosen when the user attempts to add a Plane object from the keyboard. This time the difference is the program must first check if there is a free space in the planes array.
As before, the first thing that the user will enter is the tail number of the Plane to add. The program must check that this tail number is not already assigned to any Plane in the array of Planes.

If there is space and the tail number is unique, the user is asked for all the relevant Plane information and the resultant Plane object is added to the next free space in the array of Planes. If there is no free space in the array, the program returns to the main menu without asking the user for any information.

If the tail number is already assigned to a Plane, the user is informed via a message to the screen and the program returns to the main menu.

Still NO Crew information is entered in this menu choice.

2. Add Crew (basically the same as Assignment C)

This menu choice adds a Crew to a Plane, using information from the keyboard. First, of course, the program must check that there is actually at least one Plane in the array. If there are no Planes (that is, the array of Planes is empty), 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 Plane object in the array, then the user is asked for the tail number of a Plane. The program tries to find the Plane with this tail number.

If the Plane with the user entered tail number is found, then there is one further check. This is to check that that Plane does not already have its maximum number of Crew. If the Plane already has its maximum number of Crew, 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 Plane with the user entered tail number is found and is not at its maximum crew, then the user is asked to enter the id of a Crew. There is one final check. The program must check that this user entered Crew id is not already in use. If the user entered Crew 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.

This is a more complex problem than in Assignment C, although it is still the same condition. As each Plane now has an array of Crew, the program has to go through all the Plane objects in the array of Planes and check through the array of Crew in each Plane. Only when this has been done and the id for that Crew has not been found do we know that the Crew id entered by the user is indeed unique.

There are 2 basic strategies for doing this, the first is to return a (privacy leak free) copy of the Crew array for an individual Plane to the main driver program (Carrier). The program can then go through this array checking the Crew id's in that array with the id entered by the user. If the id is not found and there is another Plane in the array of Planes, the program moves to the next Plane, gets a copy of the Crew array for that Plane and searches through that array.

The alternative is to write a method in the Plane class that takes the user entered id as a parameter. The method in the Plane class searches through the Crew array and returns true or false as to whether the Crew id passed in as a parameter was found.

Either method is acceptable, write the one that you feel most comfortable with.

If the program gets to this point, then there is a Plane object with the user entered tail number and the user entered Crew id is unique. The user is then asked to enter the name and role of the Crew and the Crew object is added to the Crew array for that Plane object. (The number of missions must be 0, as we have just instantiated the Crew and the experience level is worked out by the Crew constructor, based on the number of missions).

If there is not a Plane with the user entered tail number, then a message is displayed to the screen and the program returns to the main menu, without asking for any more information.

3. Display

This menu choice displays the contents of the non-null Plane object references to the screen. The format is shown in the sample run of the program on page 16. This time you are free to format the output any way you see fit, with a reminder that the output must be easy for the user of the program to quickly understand. Calling any of these menu choices must not result in the program crashing (for example, NullPointerException)

This is now the top level menu for display. When the user selects this top level option, another sub menu will be presented.

Flight Ops Display Menu
1. Display all
2. Display Planes (no Crew)
3. Display Single Plane
4. Display Single Crew
5. Display Planes on a mission
6. Return to main menu

Enter choice >>

1. Display all
Choosing this menu option, all of the Planes, with all their Crew, are displayed to the screen.

2. Display Planes (no Crew)
Choosing this menu option, all of the Planes, this time without any Crew information, are displayed to the screen.

3. Display Single Plane
Choosing this menu option, the user is prompted (asked) for the tail number of a Plane. If the Plane with that tail number is found in the array, then all the information about that Plane, including its Crew, are displayed to the screen. If the Plane with that tail number is not found in the array, then an appropriate message is displayed to the screen.

4. Display Single Crew
Choosing this menu option, the user is prompted (asked) for the id of a Crew. If the Crew with that id is found, then the information for that one Crew is displayed to the screen. If the Crew with the requested id is not found, then an appropriate message is displayed to the screen.

5. Display Planes on a mission
Choosing this menu option, only those Planes that are on a mission, with their Crew information, are displayed to the screen

6. Return to main menu 4. Assign Mission
This menu choice first checks that there is at least one Plane object reference in the array. If not, 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 Plane object reference in the array, then the user is prompted (asked) for the tail number of a Plane.

The program must then find the Plane that contains the Plane object with this tail number. This could be anywhere in the array. If the Plane with that tail number is not found, then an appropriate message is displayed to the screen and the program returns to the main menu.

If the Plane with that tail number is found, then the program must check that this Plane is available for a mission.

To be available for a mission, the user must enter the required experience level of the mission. The Plane must not be flying and the Plane must have a Crew with the overall experience level greater than or equal to the experience level entered by the user. This is explained in detail above.

If the Plane is not available for a mission, then an appropriate message is displayed to the screen and the program returns to the main menu.

If the Plane can be assigned a mission, then the appropriate changes are made to the Plane object. These are that the number of missions flown by all the Crew, of that Plane, are incremented by 1 (do not forget to check whether this crosses one of the boundaries of the experience level, resulting in a change in experience level) and the flying attribute is set to true, indicating that the Plane is on a mission.

The program always returns to the main menu at the end of the menu choice, regardless of the action taken or not taken.

5. End Mission

This menu choice prompts (asks) the user for the tail number of a Plane, after making the same checks as in Assign Mission, that is, there is actually at least one non-null Plane object in the array. As with Assign Mission appropriate messages should be displayed to the screen if the Plane tail number is not found, array of Planes is empty, or if the tail number is found but that Plane is not already on a Mission. (You can't end a mission unless the Plane is currently on a mission.)

If any of the above are true, then the program returns to the main menu.

If the Plane tail number exists and the Plane is on a mission, then the flying attribute is set to false, indicating that the Plane is not on a mission.

The mission time for the Plane is also reset to 0.

After the conclusion of any and all actions in this menu choice, the program returns to the main menu.

6. Save to file (see pages 23 - 24 for how to do this)

Choosing this menu option, the user is prompted (asked) for the name of an output text file and all the information in the array is written to this text file.

File names must NOT be hard coded.

Also recall that this output file must be able to be used as input file the next time that the program is run, so the output file needs to be written to the file in the format as shown on page 10.

7. Close Flight Ops

This menu choice closes the program, without asking the user if they would like to save their changes.

Electronic Submission of the Source Code
- Submit all the Java files that you have developed in the missions 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 Crew.java submit OOF Plane.java submit OOF Carrier.java

After submitting the files, you can run the following command that lists the files submitted from your account:

verify

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.

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 12 (Oct 19 2016)

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.

Attachment:- Assignment.rar

Reference no: EM131243774

Questions Cloud

Surgical procedures during hospitalization : Surgical Procedures during Hospitalization: List 2 teaching needs you have identified for this client. List Nursing Diagnosis: 2 physiological and 1 teaching and three Nursing Interventions
Combination of content or the steps will be acceptable : This post must be at least 400 words 1) Using your book and the Internet, please explain the Linux Boot Process A combination of content or the steps will be acceptable Be sure to cite your sources, the post must contain at least three sources (one c..
Describe the clinical presentation of chronic kidney disease : Explain how you might diagnose a patient with chronic kidney disease including the role that patient history, physical exams, and diagnostics play in diagnosis. Explain implications of potential treatment options for this disease including prescrib..
Design and program to allow for iteration : Modify the design and program to allow for iteration. Increase the number of guesses to 10 to solve the word. Display the word to the user with each letter as a special character such as ********. Create an array of correct letters guessed such as..
Determine the required experience level : Design programs that conform to given specifications - to practise combining multiple classes and methods into a whole program
Considering variants of the motherboard : When considering variants of the motherboard including: Full ATX, Micro-ATX, is the difference between these boards just the size of the desktop casing or do they have a difference in power and perhaps expansion slot?
Presentation on global demographic trend impacting diversity : Prepare a presentation on The Global Demographic Trends Impacting Diversity. Include detailed speaker notes with your presentation that fully explain each point and justification for your recommendations.
Discuss the rationale behind taxonomists placing sharks : Discuss the rationale behind taxonomists placing sharks and dolphins in different taxonomic groups, even though they are both aquatic, have very similar body forms, and share other traits as well.
Enhanced aquarium calculator based on week two : Design, implement, test, and debug a Visual Basic® program to create an enhanced aquarium calculator based on Week Two. Use that program and add these new features.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Which statement is true about a non-static inner class

Which statement is true about a non-static inner class? Clicking the closing button on the upper-right corner of a frame generates a(n) _____ event.

  Implement a generic class set

Implement a generic class Set that maintains a set of items of generic type T using the class LinkedList in the Java API. Your Set class must provide the subsequent functionality:

  Implement a third component of the compiler

To detect duplicate declarations using the same identifier, you call the method retrieveOneLevel. This method returns a pointer to the identifier entry if the identifier was declared before in the current scope and null otherwise.

  Application for an animal-fur trimming service

Create an application for an animal-fur trimming service. Write the code for the application. Prompt the user to indicate how many animals. Display the total fee for one year. Be pleasant in your output as it will be expensive.

  Write a program called render.java

Optionally you may wish to add texture mapping to make your models look more realistic, and you may want to supply the user some controls that affect the colours and lighting.

  Constructor that initializes the three automatic properties

Create a class called Date that adds three pieces of information as automatic properties-a   month (type int), a day (type int) and a year (type int).

  Java program to print strings given at command line

Write down program Average.java to print strings which it is given at command line, one per line. If nothing is given at command line, then print "No arguments".

  Write erring section of code and explain what the error is

The class below has some errors. For each error do the following: Write the erring section of code and explain what the error is.

  Picky publishing house publishes stories

Picky Publishing House publishes stories in three categories and has strict require- ments for page counts in each category. Create an abstract class named Story that includes a story title, an author name, a number of pages, and a String message. In..

  Each instance of this class will represent one book a book

each instance of this class will represent one book. a book consists of the title of the book a string and the authors.

  Write java program using array list object

Write a java program (using eclipse) using ArrayList object to allow the professor to enter student's name, his or her's four test scores.

  Explain the relationship between a class and an object

Classes and objects are the fundamental concepts of object-oriented programming language. What are classes and objects? Explain the relationship between a class and an object

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd