0% found this document useful (0 votes)
8 views2 pages

Csci300 Assignment2

The document outlines Assignment II for the CSCI300 course at Lebanese International University, which involves creating a Vehicle class and a TaxiAgency class with specified attributes and methods. Students are required to implement a driver program that manages a TaxiAgency, adds vehicles, finds a suitable vehicle for a given destination, and outputs relevant information. The assignment is due by April 16th and emphasizes proper coding practices and documentation.

Uploaded by

alibadran2001.ab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Csci300 Assignment2

The document outlines Assignment II for the CSCI300 course at Lebanese International University, which involves creating a Vehicle class and a TaxiAgency class with specified attributes and methods. Students are required to implement a driver program that manages a TaxiAgency, adds vehicles, finds a suitable vehicle for a given destination, and outputs relevant information. The assignment is due by April 16th and emphasizes proper coding practices and documentation.

Uploaded by

alibadran2001.ab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment II

Lebanese International University


CSCI300 – Intermediate Programming With Objects
Assignment 2

1. Create the class Vehicle as presented in the above UML:


 driver: the driver name
 isFree: indicate whether a vehicle is free
 capacity: indicate how many passengers in addition to the driver this vehicle can transport.
 xLocation, yLocation are the coordinate of the current position of the vehicle
 the getDistance method computes and returns the distance between the location of the vehicle and the
destination passed as parameter.

2. Create the class TaxiAgency:


 data fields:
o nbOfVehicles: how many vehicles this agency has.
o vehicles: An array of objects of the class Vehicle with a maxSize of 100.
 methods:
o An empty constructor that creates TaxiAgency.
o getVehicle(int i) method that returns the Vehicle at index i in the array.
o A method addVehicle that allows the user to add a Vehicle to the Agency. This method should not
allow adding Vehicle of the same driver.
o A method findVehicle that finds and returns a Vehicle that is:
 A free Vehicle
 Its capacity is greater than or equal to the number of passengers passed as
parameter.
o A toString method which returns information in the form (driver ,capacity) about all vehicles in
the agency.

3. Write a driver TaxiAgency that does the following:


a. Create a TaxiAgency and add to it 4 Vehicles. Do not use Scanner.
b. Find a vehicle to go to (x=50, y=100) for 5 passengers
c. Output the name of the driver of the vehicle at index 3
d. Output all the data of the agency.

Page 1 of 2
Assignment II

Assignment Guidelines:

 This assignment is posted on Sunday April 9th and is due by e-mail on Sunday April 16rd by midnight.

 This assignment covers chapter 8 & 10.

 Assignments (the .java files) should be posted to Google Classroom. Do not post documents/text files with the
.docx or .txt extension.
 Make sure that you use meaningful names, documentation (comments), and indentation.
 The code (program) should contain in the documentation (comments) your name.

Page 2 of 2

You might also like