Programming Task In this assignment you are required to code Java classes and methods. Only a tester class and its expected console output are given to you. The tester class illustrates how instances...

1 answer below »
This is an intro to Java Programming assignment. Need to use the starter code and can't edit it, I have attached it. The detailed task and what needs to be done and how it is graded is in the PDF below. Please read carefully. I will need it by 11am tomorrow morning, Saturday April 4th. Thank you!


Programming Task In this assignment you are required to code Java classes and methods. Only a tester class and its expected console output are given to you. The tester class illustrates how instances of classes are supposed to be created, and how methods may be invoked on their instances. Don’t modify the tester! From this tester class, which does not compile to begin with, you are required to: 1. Identify the missing classes and methods (constructors, accessors, and mutators). 2. Create all missing classes, as well as add headers of all required methods (i.e., name, return type, input parameters, and return default values for accessors). Completing the above two tasks should make everything compile. 3. Implement the required methods (with any extra attributes or helper methods which you consider necessary), such that executing the given tester produces the expected console output. You can use any API methods to solve these tasks. Download the zipped project file and import it as with the in-lab exercises: Extract the zip file. Launch Eclipse and choose File > Import. Select General > Existing Projects into Workspace, click Next, click Browse..., select the directory called LT2 Starter, and then click "Finish". Important: None of the methods that you define can contain any print statements. Grading: If your submitted classes altogether compile with the given Tester class, then you already receive 10% of the marks for the assignment. It is absolutely critical that you submit Java code that compiles (i.e., no red crosses shown on the Eclipse editor). Your grade will be zero if your code contains any compilation errors (i.e., syntax errors or type errors). If there is a part of your code that does not compile, don’t include it in your submission. To determine the remaining 90% of your marks, we will run test cases on your submitted classes. Say we run 10 test cases on your submitted code, and your submitted code compiles and passes 6 of them, then your final marks are: 10 + 90*6/10 = 64. Your code needs to be general. That means it needs to work with any input numbers, not just with the given example numbers in the Tester class. Don’t hardcode! System Requirements Percentages behind each paragraph signify the % of your grade determined by each part. 0) Code compiles (10%) 1) You need to develop a flight management system for an airline. Each flight is characterized by its flight number, origin airport, destination airport and distance. Airports are characterized by their three-letter airport code and country code. Airplanes have a type name, range in km and number of seats. Passengers have a name and integer passport number. (53.3%) 2) Each flight stores a list of passengers. (6.7%) 3) Passengers store a list of flights they are taking. When a passenger is added to a flight, this flight also needs to be added to the list of flights stored by the passenger. (3.3%) 4) Each flight has an airplane type. Before a plane is added, the method needs to check whether the plane’s range is sufficiently large for the flight distance. If successful, the method needs to return true. If unsuccessful, it needs to return false. (6.7%) 5) A method is needed to determine whether the flight is overbooked i.e. it checks whether there are more passengers on the flight than seats on the plane. If the number of passengers is larger than the number of seats, the method needs to return by how many passengers the flight is overbooked. If not, the method needs to return zero. (6.7%) 6) Flights can be domestic (i.e. origin and destination have the same country code) or international (i.e. origin and destination have different country codes). We need a boolean method that determines whether a flight is international or domestic. (6.7%) 7) The airline needs a list of any passengers on a particular flight who have not yet entered their passport numbers, which is signified by a passport number of 0 in the system. (3.3%) 8) Passengers receive frequent flyer points for every flight they take. 1 point for domestic flights, 3 points for international flights. Based on a passenger’s list of flights, the system needs to calculate their total number of points. (3.3%) You are required to write, in valid Java syntax, classes, attributes, and methods to implement the above system requirements. Study the FlightTester class and its expected output carefully. It indicates the classes and headers of methods that you need to define. You are forbidden to define additional classes, whereas you are free to declare extra attributes or helper methods as you find necessary.
Answered Same DayApr 03, 2021

Answer To: Programming Task In this assignment you are required to code Java classes and methods. Only a tester...

Ankit answered on Apr 04 2021
155 Votes
LT2Starter/.classpath

    
    
    
LT2Starter/.project

     LT2Starter
    
    
    
    
        
             org.eclipse.jdt.core.javabuilder
            
            
        
    
    
         org.eclipse.jdt.core.javanature
    
LT2Starter/bin/Airplane.class
public synchronized class Airplane {
public String type;
public int range;
public int seats;
public void Airplane(String, int, int);
public String getType();
public void setType(String);
public int getRange();
public void setRange(int);
public int getSeats();
public void setSeats(int);
}
LT2Starter/bin/Airport.class
public synchronized class Airport {
public String code;
public String country;
public void Airport(String, String);
public String getCode();
public voi
d setCode(String);
public String getCountry();
public void setCountry(String);
}
LT2Starter/bin/Flight.class
public synchronized class Flight {
private int flight_number;
private int seats_left;
Airport origin;
Airport destination;
private double distance;
Passenger passengers1;
public java.util.List passengers;
private java.util.ArrayList passengerlist;
private java.util.ArrayList noPassports;
public void Flight(int, Airport, Airport, double);
public int getFlightNumber();
public void setFlightNumber(int);
public Airport getOrigin();
public void setOrigin(Airport);
public Airport getDestination();
public void setDestination(Airport);
public double getDistance();
public void setDistance(double);
public String toString();
public void addPassenger(Passenger);
public java.util.ArrayList getPassengerList();
public boolean setPlane(Airplane);
public int overBooked();
public boolean isInternational();
public java.util.ArrayList noPassports();
}
LT2Starter/bin/FlightTester.class
public synchronized class FlightTester {
public void FlightTester();
public static void main(String[]);
}
LT2Starter/bin/Passenger.class
public synchronized class Passenger {
public static java.util.List flights;
public String name;
public int passport_number;
Airport origin;
Airport destination;
static void ();
public void Passenger(String, int);
public void Passenger(String, int, Airport, Airport);
public java.util.List getflights();
public void setflights(java.util.List);
public String getName();
public void setName(String);
public int getPassportNumber();
public void setPassportNumber(int);
public Airport getOrigin();
public void setOrigin(Airport);
public Airport getDestination();
public void setDestination(Airport);
public String calculatePoints();
}
LT2Starter/FlightTester_Expected_Output.txt
(1.1)-------------------------------
YYZ
CAN
(1.2)-------------------------------
Bombardier CRJ700
4660
78
(1.3)-------------------------------
872
YYZ
YYZ
FRA
FRA
6343.66
Flight number 872 from YYZ to FRA with distance 6343.66km.
(1.4)-------------------------------
Susan
111111
Peter
0
(2.1)-------------------------------
First passenger: Susan
(2.2)-------------------------------
Passenger list for flight from Toronto to Ottawa:
Susan
Tom
Alice
Mike
Peter
(3)-------------------------------
Passenger Susan's first flight is from YYZ to YOW.
(4.1)-------------------------------
The A320's range is too small. Use a different plane.
(4.2)-------------------------------
787 added successfully!
(5.1)-------------------------------
Flight from Toronto to Ottawa has 2 passengers too many.
(5.2)-------------------------------
Flight from Toronto to Frankfurt has space left.
(6.1)-------------------------------
Flight from Toronto to Ottawa is domestic.
(6.2)-------------------------------
Flight from Toronto to Frankfurt is international.
(7)-------------------------------
Passengers on flight from Toronto to Frankfurt without passport:
Alice
Peter
(8)-------------------------------
Susan has 7 frequent flyer points.
LT2Starter/LT2 Instructions.pdf
EECS1021, Winter 2020
Lab Test 2
Instructions
This is a 24-hour programming test. The deadline is Saturday April 4th 2020 3pm Before you
begin, it is important that you read this entire document for instructions and advice.
If you are unsure how to interpret the programming task, write your assumptions in a comment.
You must submit your code through two systems: WebSubmit and Crowdmark via Moodle.
We will use your WebSubmit submission to run tests on your actual .java files. We will use
Crowdmark to give you feedback on your code in pdf format. If you only submit through one
platform, your grading may be delayed or you might not be graded at all!
You may submit as many times as you want. See below for submission instructions. Your most
recent submission will be the one recorded. Submit your work early and often. Work not submitted
will not be marked. Work submitted late will not be marked. Submit .java files, NOT .class. Re-
download your files and check them before the deadline.
You can use any API methods to solve these tasks.
We will use plagiarism detection software to identify any students who copied from another
student/ let someone copy from them. If this happens, both of you will receive an automatic 0 and
will be reported.
Write your name, student number and Passport York ID (first part of your York email address) as
a comment in each file!
Download the zipped project file from Moodle and import it as with the in-lab exercises: Extract
the zip file. Launch Eclipse and choose File > Import. Select General > Existing Projects into
Workspace, click Next, click Browse..., select the directory called LT2 Starter, and then click
"Finish".
Important: None of the methods that you define can contain any print statements.
Good luck and may you do your best!
Grading
If your submitted classes altogether compile with the given Tester class, then you already receive
10% of the marks for the test.
It is absolutely critical that you submit Java code that compiles (i.e., no red crosses shown on the
Eclipse editor). Your grade will be zero if your code contains any compilation errors (i.e.,
syntax errors or type errors). In labtest 1 we gave partial credit for code that did not compile but
you should be more experienced by now and you have 24 hours to fix any errors. If there is a part
of your code that does not compile, don’t include it in your submission.
To determine the remaining 90% of your marks, we will run test cases on your submitted classes.
Say we run 10 test cases on your submitted code, and your submitted code compiles and passes 6
of them, then your final marks are: 10 + 90*6/10 = 64.
Your code needs to be general. That means it needs to work with any input numbers, not just with
the given example numbers in the Tester class. Don’t hardcode!
Programming Task
In this lab test you are required to code Java classes and methods. Only a tester class and its
expected console output are given to you. The tester class illustrates how instances of classes are
supposed to be created, and how methods may be invoked on their instances. Don’t modify the
tester! From this tester class, which does not compile to begin with, you are required to:
1. Identify the missing classes and methods (constructors, accessors, and mutators).
2. Create all missing classes, as well as add headers of all required methods (i.e., name, return type,
input parameters, and return default values for accessors).
Completing the above two tasks should make...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here