Menu

Please Need Help Java Important Hope Help Q43815545

PLEASE I NEED HELP IN JAVA THIS IS VERY IMPORTANT FOR ME IHOPE SOME CAN HELP ME
1. Implement a Vehicle class with the following UML diagram. Vehicle plateNumber: String size: int Vehicle (plateNumber: Stri• Consider the following example which demonstrates the creation of a ParkPlace object: ParkPlace parkPlace = new ParkPlace (If the vehicle does not exit from the car park up to now, then the string should have the vehicles plate number and entry da5. Write a test program in which the following are performed in order. a. Create a new Car Park object with the capacity of 11. Implement a Vehicle class with the following UML diagram. Vehicle plateNumber: String size: int Vehicle (plateNumber: String, size: int) getPlateNumber(): String getSize(): int getVehicleInfo(): String + • A Vehicle object represents a vehicle with a license plate number and size. The data field of size may take the values of 1, 2, and 4. (You may simply assume that 1: motorcycle, 2: car, 4: truck) You have to use this keyword in the implementation of the constructor. Consider the following example which demonstrates the creation of a vehicle object: Vehicle vehicle = new Vehicle (“34CSE1141”, 2); get PlateNumber method should return the plate number of the vehicle. • getSize method should return the size of the vehicle. get VehicleInfo method returns a string containing the vehicle’s license plate number and the size of the vehicle. An example string as the following: Vehicle Info Plate Number : 34CSE1141 Size : 2 2. Implement a ParkPlace class with the following UML diagram. ParkPlace size: int vehicle: Vehicle + ParkPlace (vehicle: Vehicle) getSize(): int getVehicle(): Vehicle • A ParkPlace object represents a suitable place that the vehicle will be parked. A ParkPlace object is created with a size of the vehicle and the vehicle itself. You have to use this keyword in the implementation of the constructor. • • Consider the following example which demonstrates the creation of a ParkPlace object: ParkPlace parkPlace = new ParkPlace (vehicle); • getSize method returns the size of the ParkPlace object. The size of the ParkPlace might be suitable for a motorcycle, a car, or a truck • getVehicle method returns the Vehicle object of the ParkPlace object. This represents which vehicle is parked in that place. 3. Implement a Ticket class with the following UML diagram. Ticket vehicle: Vehicle entry Date: java.util.Date exitDate: java.util.Date totalPrice: double numberOfTickets: int Ticket(vehicle: Vehicle, entryDate: java.util.Date) calculate Price (hourlyPrice: double, exitDate: java.util.Date): double getTicketInfo 0: String getVehicle(): Vehicle getPrice(): double • When a vehicle is parked, a Ticket object is created containing the vehicle itself and entry date of the vehicle. • You have to use this keyword in the implementation of the constructor. . Consider the following example which demonstrates the creation of a Ticket object: Ticket ticket – new Ticket (vehicle, entryDate); • Calculate Price method takes a double value of hourly price and exit date of the vehicle, then calculates the price of parking service by considering how many hours the vehicle is parked and the size of the vehicle. The totalPrice field of the Ticket object should also be updated in this method. • You can calculate the parking cost with the following formula: Parking cost = vehicleSize hourlyPrice numberOfHours It should be noted that the numberOfHours value should be rounded up. (Example: If a car parked for 3 hours and 20 minutes, then you should charge the parking cost with 4 hours.) • The getTicket Info method returns a string value based on two conditions. If the vehicle does not exit from the car park up to now, then the string should have the vehicle’s plate number and entry date. Example: Ticket Info Plate Number: 34CSE1141 Entry: Fri Dec 15 11:03:48 EET 2017 If the vehicle exited from the car park, then the string should have the vehicle’s plate number, entry date, exit date, and the total price for parking service. Example: Ticket Info Plate Number 34CSE1141 Entry : Fri Dec 15 11:03:48 EET 2017 Exit : Fri Dec 15 16:03:48 EET 2017 Hour : 5 Fee $0.0 TLS • getVehicle method returns the Vehicle object of the Ticket object. • get Price method returns the total price field of the Ticket object. 4. Implement a Car Park class with the following UML diagram. CarPark capacity: int parkPlaceArray: Park Place() ticketArray: Ticket() hourly Price: double CarPark(capacity: int, hourly Price: double) park Vehicle (vehicle: Vehicle, entry Date: java.util.Date): Ticket exit Vehicle (ticket: Ticket, exitDate: java.util.Date): Vehicle get TotalIncome 0: double print VehicleList(): void print Tickets(): void A Car Park object has o a capacity indicating the total size of the car park, o a ParkPlaceArray which shows suitable park places, O a TicketArray indicating the tickets of the car park, and o a hourlyPrice field indicating the price of the parking service for an hour. A Car Park object is created with a capacity and an hourly price values. You have to use this keyword in the implementation of the constructor Consider the following example which demonstrates the creation of a Car Park object with 100 place capacity and hourly price of 5 TLs: 5. Write a test program in which the following are performed in order. a. Create a new Car Park object with the capacity of 10 and the hourly price of 5 TLs. b. Create 5 vehicles with different license plate numbers and the following sizes: • 4, 2, 1, 2, 4. c. These vehicles should try to enter to the car park with one-hour delays. • You may assume that the first car will be entered in current time. current time is Fri Dec 15 03:02:20, then the second car will be entered at Fri Dec 15 04:02:20, the third car will be entered at Fri Dec 15 05:02:20, etc. d. Assume that the car park is filled with the first four vehicles and there is no space for the fifth one. e. Print the content of vehicle list at that time. • Invoke print VehicleList method of Car Park object. f. After a while, two vehicles exit from the car park (you can pick a random value for the total number of hours). g. Invoke the print VehicleList method of the Car Park object. h. After a while, remaining vehicles exit from the car park. i. Print the total income earned until now by calling the get TotalIncome method of the Car Park object. j Print the total number of tickets processed until now by accessing the numberOfTicket field of the Ticket class. k. Print the details of each tickets by invoking print Tickets method of Car Park object. This is a simple scenario to test your class implementations. There might be other test cases too. Therefore, please pay attention to use the same class, method and variable names in your implementations. You are allowed to increase the number of methods in the classes; however, you cannot decrease the number of them. You are not allowed to use ArrayLists in the homework! You can only use Arrays. Show transcribed image text 1. Implement a Vehicle class with the following UML diagram. Vehicle plateNumber: String size: int Vehicle (plateNumber: String, size: int) getPlateNumber(): String getSize(): int getVehicleInfo(): String + • A Vehicle object represents a vehicle with a license plate number and size. The data field of size may take the values of 1, 2, and 4. (You may simply assume that 1: motorcycle, 2: car, 4: truck) You have to use this keyword in the implementation of the constructor. Consider the following example which demonstrates the creation of a vehicle object: Vehicle vehicle = new Vehicle (“34CSE1141”, 2); get PlateNumber method should return the plate number of the vehicle. • getSize method should return the size of the vehicle. get VehicleInfo method returns a string containing the vehicle’s license plate number and the size of the vehicle. An example string as the following: Vehicle Info Plate Number : 34CSE1141 Size : 2 2. Implement a ParkPlace class with the following UML diagram. ParkPlace size: int vehicle: Vehicle + ParkPlace (vehicle: Vehicle) getSize(): int getVehicle(): Vehicle • A ParkPlace object represents a suitable place that the vehicle will be parked. A ParkPlace object is created with a size of the vehicle and the vehicle itself. You have to use this keyword in the implementation of the constructor. •
• Consider the following example which demonstrates the creation of a ParkPlace object: ParkPlace parkPlace = new ParkPlace (vehicle); • getSize method returns the size of the ParkPlace object. The size of the ParkPlace might be suitable for a motorcycle, a car, or a truck • getVehicle method returns the Vehicle object of the ParkPlace object. This represents which vehicle is parked in that place. 3. Implement a Ticket class with the following UML diagram. Ticket vehicle: Vehicle entry Date: java.util.Date exitDate: java.util.Date totalPrice: double numberOfTickets: int Ticket(vehicle: Vehicle, entryDate: java.util.Date) calculate Price (hourlyPrice: double, exitDate: java.util.Date): double getTicketInfo 0: String getVehicle(): Vehicle getPrice(): double • When a vehicle is parked, a Ticket object is created containing the vehicle itself and entry date of the vehicle. • You have to use this keyword in the implementation of the constructor. . Consider the following example which demonstrates the creation of a Ticket object: Ticket ticket – new Ticket (vehicle, entryDate); • Calculate Price method takes a double value of hourly price and exit date of the vehicle, then calculates the price of parking service by considering how many hours the vehicle is parked and the size of the vehicle. The totalPrice field of the Ticket object should also be updated in this method. • You can calculate the parking cost with the following formula: Parking cost = vehicleSize hourlyPrice numberOfHours It should be noted that the numberOfHours value should be rounded up. (Example: If a car parked for 3 hours and 20 minutes, then you should charge the parking cost with 4 hours.) • The getTicket Info method returns a string value based on two conditions.
If the vehicle does not exit from the car park up to now, then the string should have the vehicle’s plate number and entry date. Example: Ticket Info Plate Number: 34CSE1141 Entry: Fri Dec 15 11:03:48 EET 2017 If the vehicle exited from the car park, then the string should have the vehicle’s plate number, entry date, exit date, and the total price for parking service. Example: Ticket Info Plate Number 34CSE1141 Entry : Fri Dec 15 11:03:48 EET 2017 Exit : Fri Dec 15 16:03:48 EET 2017 Hour : 5 Fee $0.0 TLS • getVehicle method returns the Vehicle object of the Ticket object. • get Price method returns the total price field of the Ticket object. 4. Implement a Car Park class with the following UML diagram. CarPark capacity: int parkPlaceArray: Park Place() ticketArray: Ticket() hourly Price: double CarPark(capacity: int, hourly Price: double) park Vehicle (vehicle: Vehicle, entry Date: java.util.Date): Ticket exit Vehicle (ticket: Ticket, exitDate: java.util.Date): Vehicle get TotalIncome 0: double print VehicleList(): void print Tickets(): void A Car Park object has o a capacity indicating the total size of the car park, o a ParkPlaceArray which shows suitable park places, O a TicketArray indicating the tickets of the car park, and o a hourlyPrice field indicating the price of the parking service for an hour. A Car Park object is created with a capacity and an hourly price values. You have to use this keyword in the implementation of the constructor Consider the following example which demonstrates the creation of a Car Park object with 100 place capacity and hourly price of 5 TLs:
5. Write a test program in which the following are performed in order. a. Create a new Car Park object with the capacity of 10 and the hourly price of 5 TLs. b. Create 5 vehicles with different license plate numbers and the following sizes: • 4, 2, 1, 2, 4. c. These vehicles should try to enter to the car park with one-hour delays. • You may assume that the first car will be entered in current time. current time is Fri Dec 15 03:02:20, then the second car will be entered at Fri Dec 15 04:02:20, the third car will be entered at Fri Dec 15 05:02:20, etc. d. Assume that the car park is filled with the first four vehicles and there is no space for the fifth one. e. Print the content of vehicle list at that time. • Invoke print VehicleList method of Car Park object. f. After a while, two vehicles exit from the car park (you can pick a random value for the total number of hours). g. Invoke the print VehicleList method of the Car Park object. h. After a while, remaining vehicles exit from the car park. i. Print the total income earned until now by calling the get TotalIncome method of the Car Park object. j Print the total number of tickets processed until now by accessing the numberOfTicket field of the Ticket class. k. Print the details of each tickets by invoking print Tickets method of Car Park object. This is a simple scenario to test your class implementations. There might be other test cases too. Therefore, please pay attention to use the same class, method and variable names in your implementations. You are allowed to increase the number of methods in the classes; however, you cannot decrease the number of them. You are not allowed to use ArrayLists in the homework! You can only use Arrays.

Expert Answer


Answer to PLEASE I NEED HELP IN JAVA THIS IS VERY IMPORTANT FOR ME I HOPE SOME CAN HELP ME…

OR