Can anyone help me with this?

You have been hired by the Wayne County Road Commission to write a Java console application that dispatches patching trucks on county roads. It reads truck and route data from files and stores them in objects. It then reads an order file to dispatch trucks on various routes. The application has the following three classes:

Truck.java This class represents one truck and includes:

● Fields truckCount (static) – initialize to 0 truckID driver status – this will be ‘active’ or ‘inactive’ totalHours hoursLeft

● A constructor with no parameters that sets the fields, respectively, to these values: truckCount = truckCount + 1 truckID = -1 driver = "(not set)" status = "(not set)" totalHours = 0 hoursLeft = 0 This methods prints a message to the user that the truck is now in service, and show the total trucks in service. It uses the toString method to show truck information.

● A constructor with two parameters that sets the fields, respectively, to these values: truckCount = truckCount + 1 truckID – set from parameter driver – set from parameter status = "active" totalHours = 0 hoursLeft = 0 This methods prints a message to the user that the truck is now in service, and show the total trucks in service. It uses the toString method to show truck information.

● Getter methods for each field (declare the getter for truckCount static).

● Setter methods for each non-static field.

● equals method that compares truckID for equality.

● toString method for returning instance variable values only. The returned string separates values with “/” and occupies one line.

Road.java This class represents one road and includes:

● Fields roadCount (static) – initialize to 0 roadID roadHours – the number of hours to patch this road

● A constructor with no parameters that sets the fields, respectively, to these values: roadCount = roadCount + 1 routeID = -1 roadHours = 0 This methods prints a message to the user that the road is now in service, and show the total roads in service. It uses the toString method to show road information.

● A constructor with two parameters that sets the fields, respectively, to these values: roadCount = roadCount + 1 roadID – set from parameter roadHours – set from parameter This methods prints a message to the user that the road is now in service, and show the total roads in service. It uses the toString method to show road information.

● Getter methods for each field (declare the getter for roadCount static). ● Setter methods for each non-static field.

● equals method that compares roadID for equality.

● toString method for returning instance variable values only. The returned string separates values with “/” and occupies one line. HW8.java This class contains the main method and uses the other classes to manage truck and road data, and to process orders. It has the following methods:

● getTruckData reads data from file TruckData.txt. The method reads data from the file, creates four truck objects, and stores them in array trucks. Here is the data for creating that file. The first column are truckIDs and the second column are drivers: 10 Greg Geargrinder 20 Sammy Slowpoke 30 Pauline Pavegold 40 Conner Conehead

● getRoadData reads data from file RoadData.txt. The method reads data from the file, creates four road objects, and stores them in array roads. Here is the data for creating that file. The first column are roadIDs and the second column are hours it takes to patch that road: 110 4 120 5 130 2 140 1

● processOrders reads data from file OrderData.txt. The method reads orders from the file and processes them.

Here is the data for creating that file. The first column are order types (truck, inactivate, activate) and the second column are road IDs or truck IDs. truck 110 means assign a truck to patch the road with ID 110. inactivate 10 means remove the truck with ID 10 from service. activate 10 means return the truck with ID 10 to service. truck 110 truck 120 inactivate 30 truck 130 truck 140 activate 30 inactivate 10 truck 120 truck 130 activate 10 truck 140 truck 110 The application simulates the processing of one order per hour so each line in the file is equal to one elapsed hour.

For each order:

1) Subtract one from the hours left for each active truck.

2) Read and echo the order.

3) Test the order type:

● For “truck”, find the active truck with the lowest hours left and assign them the patching job. Use the route ID in the order to get the hours it takes to patch that route. Add those hours to the total hours and hours left for that Truck. Print which Truck got assigned the route.

● For “activate", find the truck with the given ID and change its status to “active”. Print that the truck is back in service.

● For “inactivate", find the truck with the given ID and change its status to “inactive”. Print that the truck is out of service.

4) Print the status of each truck using method printTruckStatus (described below).

● printTruckStatus prints the status of each truck including its ID, status, total hours, and hours left.

Edited 4 Months Ago by happygeek: moved

You just copy/pasted your assignment without even a moment taken to explain what help you need.

There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you.

DaniWeb Member Rules (which you agreed to when you signed up) include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
https://www.daniweb.com/welcome/rules

Post what you have done so far and someone will help you from there.

Edited 4 Months Ago by JamesCherrill

Unfortunately, I don't even know how to start this assignment.

Its unlikely that your teacher has set you an assignment that you cannot even start, so let's take a deep breath and go one step at a time.

Truck.java This class represents one truck and includes: Fields truckCount (static) – initialize to 0. truckID driver status – this will be ‘active’ or ‘inactive’ . totalHours hoursLeft

create a class definition with those fields - post it here if you want someone to check it.

Edited 4 Months Ago by JamesCherrill

The article starter is a financial contributor. Sponsored articles offer a bounty for quality replies.