Page 1 of 1

CarData.txt MeterData.txt Please do this in java and do not copy other answers from answers. Please comment on your code t

Posted: Fri Apr 29, 2022 6:47 am
by answerhappygod
Cardata Txt Meterdata Txt Please Do This In Java And Do Not Copy Other Answers From Chegg Please Comment On Your Code T 1
Cardata Txt Meterdata Txt Please Do This In Java And Do Not Copy Other Answers From Chegg Please Comment On Your Code T 1 (125.69 KiB) Viewed 22 times
Cardata Txt Meterdata Txt Please Do This In Java And Do Not Copy Other Answers From Chegg Please Comment On Your Code T 2
Cardata Txt Meterdata Txt Please Do This In Java And Do Not Copy Other Answers From Chegg Please Comment On Your Code T 2 (202.59 KiB) Viewed 22 times
Cardata Txt Meterdata Txt Please Do This In Java And Do Not Copy Other Answers From Chegg Please Comment On Your Code T 3
Cardata Txt Meterdata Txt Please Do This In Java And Do Not Copy Other Answers From Chegg Please Comment On Your Code T 3 (195.19 KiB) Viewed 22 times
Cardata Txt Meterdata Txt Please Do This In Java And Do Not Copy Other Answers From Chegg Please Comment On Your Code T 4
Cardata Txt Meterdata Txt Please Do This In Java And Do Not Copy Other Answers From Chegg Please Comment On Your Code T 4 (117.53 KiB) Viewed 22 times
Cardata Txt Meterdata Txt Please Do This In Java And Do Not Copy Other Answers From Chegg Please Comment On Your Code T 5
Cardata Txt Meterdata Txt Please Do This In Java And Do Not Copy Other Answers From Chegg Please Comment On Your Code T 5 (113.7 KiB) Viewed 22 times
CarData.txt
Cardata Txt Meterdata Txt Please Do This In Java And Do Not Copy Other Answers From Chegg Please Comment On Your Code T 6
Cardata Txt Meterdata Txt Please Do This In Java And Do Not Copy Other Answers From Chegg Please Comment On Your Code T 6 (259.53 KiB) Viewed 22 times
MeterData.txt
Cardata Txt Meterdata Txt Please Do This In Java And Do Not Copy Other Answers From Chegg Please Comment On Your Code T 7
Cardata Txt Meterdata Txt Please Do This In Java And Do Not Copy Other Answers From Chegg Please Comment On Your Code T 7 (39.31 KiB) Viewed 22 times
Please do this in java and do not copy other answers
from answers. Please comment on your code to help me understand.
Thank you.
I. ParkedCar Class Implement the ParkedCar class according to the UML diagram below. This class is meant to hold information about a car. It has a cars make, model, color, license plate and how long the car has been parked. Make sure your fields have the correct access modifiers. Include setter and getter methods for all of the fields, even if they are not in the UML. ParkedCar make : String model: String - color : String license Plate : String minutesParked : int + ParkedCar( mk:String, md:String, col:String, lic:String, minParked:int) + ParkedCar( car:ParkedCar) + toString(): String add setter and getter methods II. Parking Meter Class Implement the ParkingMeter class according to the UML diagram below. The ParkingMeter class is meant to hold information about the number of minutes that have been purchased. Include a toString() method, a setter and a getter method for the field. Parking Meter minutes Purchased : int + ParkingMeter( minPurchased : int) + toString(): String add setter and getter methods
III. Police Officer Class Implement the Police Officer class according to the UML diagram below. This class is meant to hold information about the police officer. Police officers name and badge number. Besides the constructors, toString and setter/getter methods, there is one more method named patrol. The method patrol() looks at how many minutes a car has been parked and the number of minutes purchased on the parking meter. If the minutes parked is greater than the minutes purchased on the parking meter, then a Parking Ticket object is created and returned; otherwise this methods returns null. Later in the simulation class, once you have created objects of type ParkedCar and ParkingMeter, you will call this method by passing into it a ParkedCar object and a Parking Meter object. Compare their times and either return a Parking Ticket object or null. Police Officer name: String badgeNumber : String + PoliceOfficer( name:String, badge:String) + Police Officer(officer : PoliceOfficer) + patrol(car:ParkedCar, meter:ParkingMeter) : Parking Ticket + toString(): String add setter and getter methods IV. Parking Ticket Class Implement the Parking Ticket class according to the UML diagram below. This class is meant to hold information about the parking ticket. Parking Ticket class is an aggregate class, it contains instance fields that are reference variables to ParkedCar and Police Officer objects. There are two constructors, one of them is a copy constructor. There is also a method called calculate Fine(), this method calculates the fine based on how many minutes the car has been parked illegally. For the first hour or part of the hour that the car has been parked illegally, there is a base fee of $25. After that there is an additional $10 for each hour or part of an hour that the car is parked illegally. For example if the car is parked illegally for 35 minutes, 57 minutes or 60 minutes, then there is only the base fine of $25. If the car is parked 61 minutes illegally than the fine is the base amount plus $10 for the following partial hour. Totaling at $35.
Parking Ticket car: ParkedCar officer : PoliceOfficer fine : double minutes : int + base_fine : double = 25.0 + hourly_fine : double = 10.0 + Parking Ticket(car:ParkedCar, officer:Police Officer, meterMins:int) + Parking Ticket( ticket : Parking Ticket) + calculateFine(): void + toString(): String add setter and getter methods V. Simulation Class This class will be the driver class with the main method. There are several things you need to write in this class. First download the text files “CarData.txt” and “MeterData.txt”. Inspect the files, notice how in “CarData.txt" one line has all of the information needed to create an object of type ParkedCar. The text file is set up so that you can read it one line at a time and be able to create an instance of ParkedCar. Write a method which opens and reads the text file. Inside of the method create an array of type ParkedCar and populate it as you read the text file. This method should return a reference to an array of type ParkedCar. Similarly write another method which reads the other text file and returns a reference to an array of type Parking Meter. Inside of the main method create array references to ParkedCar and ParkingMeter and assign to them the returning values from the methods which read the text files. Create a single instance of Police Officer. And an array of type ParkingTicket which should have null values in the beginning. In the text files provided there are exactly 1000 lines in each file. This means you will have 1000 objects of type ParkedCar, ParkingMeter and Parking Ticket. ParkedCar at index location “O” will have the ParkingMeter at index location “O” and a Parking Ticket at index location “O”. Once all of the objects are created, set up a loop and have the Police Officer “patrol the cars and meters. Notice how the patrol method returns a Parking Ticket. After that loop through the tickets and count how many cars were parked illegally. Also print out any
After that loop through the tickets and count how many cars were parked illegally. Also print out any Parking Ticket which was issued to a “Toyota” and was over $30. And print out the total amount fines accumulated during the simulation. csill Homework 2: Parking Ticket Simulation Page 4 of 6 VI. Sample Output Sample output for this program can be seen below in Figure 1. Make: Toyota Model: Corolla Color: Lime License Number: VDE5469 Minutes Parked: 163 Officer Data: Name: Francis Llewellyn Poncherello Badge Number: 1600 Minutes illegally parked: 83 Fine: 35.0 Make: Toyota Model: 6500 Color: Red License Number: ZDV6758 Minutes Parked: 162 Officer Data: Name: Francis Llewellyn Poncherello Badge Number: 1600 Minutes illegally parked : 66 Fine: 35.0 Make: Toyota Model: Civic Color: Blue License Number: LOL5469 Minutes Parked: 171 Officer Data: Name: Francis Llewellyn Poncherello Badge Number: 8600
VII. Upload your work to Canvas Make sure that you upload the following files to the Homework 2 assignment in your Canvas account: ParkingMeter.java Police Officer.java ParkedCar.java Parking Ticket.java Simulation.java Screenshot image containing an output of the program Using the Snipping Tool take a screenshot of the output and save it as an image. There will be additional files (the class files, that you've generated when compiling your code) in your homework 2 folder, but don't upload them to Canvas. Those files are not graded; they are just the byte code files that are used by the Java Virtual Machine. V. Rubric File / Lab Class Parking Meter is implemented correctly Class Police Officer is implemented correctly Class ParkedCar is implemented correctly Class ParkingTicket is implemented correctly Class Simulation is implemented correctly Program compiles and runs as expected using text files Screenshot of the output, comments, format Points 5 10 10 10 20 10 5 Total 70
Honda, Camry, Orange, LOL1233,116 Ferrari, G500, Red, MRE6758,171 Ford, G500, Maroon, LOL9543,132 Hyundai, Corolla,Black, KJH3456,62 Ford, Camry, Purple, MRE3456,146 Hyundai, Huracan, Green, KJH1233,71 Chevrolet, Viper, Maroon, GDF5469,65 Dodge, Viper, Yellow, KJH5469,138 Honda, Corolla, White, LOL0000, 161 Ford, Camry, White, VDE4355, 174 Toyota, Camry, Green, GDF9543,53 Mercedes, Genesis, Pink, VDE4355,53 Ferrari, Model S, Maroon, KJH9543,82 Chevrolet, Genesis,Blue, LOL4355,106 Hyundai, Model S, Lime, KJH9543,106 BMW, Civic, Pink, KJH5469,100 Ferrari, 3500, Black, KJH5469,171 Carriage, Civic, Maroon, ZDV1233,173 Mercedes, G500, Blue, LOL5469,84 Ford, 335xi, Yellow, ZDV9543,83 Hyundai, Model S, Brown, GDF4355,83 Chevrolet, Model S, Pink, GDF6758,75 Ferrari, Huracan, White, ZDV3456, 75 BMW, Huracan, Lime, KJH6758, 100 Chevrolet, Civic, Green, ASD4355,54 Honda, 335xi, Maroon, NGH4355, 153 Hyundai, G500, White, MRE0000,168 Honda, Camry, Purple, MRE9543,60 Toyota, Genesis, Brown, VDE6758,53 Chevrolet, 335xi, White, LOL4355,136 Honda, Corvette, Pink, LOL4355, 102 BMW, Viper, Black, LOL3456,168 Mercedes, Viper, Yellow, ASD6758, 103 BMW, Corvette, Purple, GDF9543,55 Toyota, Camry,Black, ZDV9543,97 Honda, Corolla, Purple, KJH3456,173 Toyota, Civic, Blue, KJH5469,109 Sled, Genesis, White, KJH9543,49 Toyota, Viper,White, ZDV0000,80 Sled, Huracan, Brown, NGH6758,49 BMW, Viper, Maroon, GDF5469,163 Chevrolet, Civic, Brown, GDF9543,162 BMW, Model S, Brown, ASD5469,111 Dodge, G500, Brown, LOL1233,135 Honda, 335xi, Lime, VDE 9543,177 Carriage, Civic, Pink, GDF5469,50 BMW, Corolla, Brown, ASD4355, 74 Ferrari, 335xi, Green, GDF9543, 61 Ford, Corvette, Orange, NGH6758,85 Chevrolet, Camry, Red, NGH9543,135 Chevrolet, 3500, Lime, LOL0000, 60 Chevrolet, Corvette, Black, ZDV5469,66
120 101 122 177 190 118 176 199 155 82 156 109 114 113 114 198 156 100 195 188 101 135 177 117 145 185 157 89 155 86 174 97 177 119 135 182 130 196 128 116 178 180 78 197 183 155 89 147 136 80 129 110