Question: i did the program for this already, and this is the testractor thats the code for the test tractor . Tractors Modification of the Tractor

 i did the program for this already, and this is the
i did the program for this already, and this is the testractor testractor thats the code for the test tractor . Tractors Modification of
thats the code for the test tractor the Tractor project. Make a copy of your testTractor Package name it
testloader and make the following modifications and additions. Let us create a
class hierarchy for tractors to use in a fleet management system. All
of your classes should be in separate files within your project package.
Name your package testLoader. Modify the base class named Tractor. The Tractor
class will have a static attribute called Company. All tractors are owned
by the same company. Create a class named Loader that inherits from

. Tractors Modification of the Tractor project. Make a copy of your testTractor Package name it testloader and make the following modifications and additions. Let us create a class hierarchy for tractors to use in a fleet management system. All of your classes should be in separate files within your project package. Name your package testLoader. Modify the base class named Tractor. The Tractor class will have a static attribute called Company. All tractors are owned by the same company. Create a class named Loader that inherits from Tractor. Loaders had a Bucket Size (1-5) the Bucket Size effects the RentalProfit by an additional $100-$500. You will need to Override the RentalProfit method to perform this calculation correctly. Create a fully parameterized constructor that uses a reference to super(). Override the toString to contain the base tractor information plus the Bucket Size option. Create a class called Harvester. Harvesters are must be rented for at least 20 days. Override the setter for Rental days to reflect this. Harvesters may have a tow behind trailer option (1-3) that adds $1000-$3000 to the RentalProfit() calculation. Create a fully parameterized constructor that uses a reference to super(). Override the toString to contain the base tractor information plus the trailer option In your test drivers main() method create a Tractor, Loader and a Harvester. Using the zero parameter contructor. Then use the set methods to set all attributes. Also create a Tractor, Loader and Harvester using the parameterized contructor, Set the company name to your name. Use the toString() methods to display the information for each tractor. Be sure to display the rentalProfit() calculation in your test driver. Create a zip file for your package and submit it for grading. Tractors Pretend we work for a company that leases tractors. Let us create a class for tractors that might be used as part of a fleet management system. All of your classes should be in separate files within your project package. Name your package testtractor. Create a class named Tractor. It will have instance variables for the Vehicle ID, Rental Rate, Rental Days. Be sure to make them all private. It will have an method for calculating RentalProfit(). Which will be rental days times rental rate. Create getter and setter methods for the Tractor's instance variables. Make sure the setter perform reasonable validation. Create a zero parameter constructor and a fully parameterized constructor for the class. Override the toString() method to return the class name, VIN, Rental Days and Rental Rate in a well formatted string. Create an application class named testTractor.java to test drive the tractor class. In your test driver's main() method create a Tractor object using the zero parameter constructor. Use the setters to assign values to the tractor. Use the toString() to display information about the Tractor. Also create a Tractor using the parameterized constructor. Use its getter methods to display information about the Tractor. Create a third tractor. Use the methods and try to set invalid values. Display the results. Nullify the third tractor object. Submit your testTractor.java file and Tractor java file. 1 puble Tractor Sort old old water public Tractor Tractor W 2012 wwer www ... TRACTOR 1 . Lectores MA Sy . co Thor RA -1 STACIONS Cert 1 L 2 public class Tractor { I 3 //Instance variables 5 private String vehicleId; 6 private double rentalRate; 7 private int rentalDays; 8 9 /** 10 * @param 11 12 public Tractor() { 13 super(); 14 15 } 16 17 /** 18 * @param vehicleId 19 * @param rentalRate 20 * @param rentalDays 21 */ 22 public Tractor (String vehicleId, double rentalRate, int rentalDays) { 23 super(); Tractor.java Tractor.java Tractor (1).java 23 24 25 super(); this.vehicleId - vehicleId; this.rentalRate rentalRate; this.rentalDays = rentalDays; } public double getRentalProfit() { return rentalRate*rentalDays; } 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 * @return the vehicleId public String getVehicleId() { return vehicleId; > * @param vehicleId the vehicleId to set etal Pai Tractor.java Tractor.java Tractor (1).java public void setVehicleId(String vehicleId) { if(vehicleId!=null && vehicleId.length( )>0) this.vehicleId = vehicleId; } 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 /** * @return the rentalRate public double getRentalRate() { return rentalRate; } u un 64 /** * @param rentalRate the rentalRate to set public void setRentalRate( double rentalRate) { if (rentalRate>0) this.rentalRate = rentalRate; } 65 66 67 68 Tractor.java Tractor.java G Tractor (1).java 50 68 69 70 71 72 73 74 75 76 77 78 * @return the rentalDays public int getRentalDays() { return rentalDays; } 79 80 81 82 83 84 85 86 87 88 89 90 * @param rentalDays the rentalDays to set */ public void setRentalDays (int rentalDays) { if(rentalDays>0) this.rentalDays = rentalDays; } @Override public String toString() { return "Tractor VehicleId: " + vehicleId + " RentalRate: > + rentalRate + " Rer 92 } 93 94 95 plass TestTractor { 96 97 public static void main(String[] args) { 98 1/Create tractor object 1 99 Tractor tractorl-new Tractor(); 100 tractori.setVehicleId("TN526325"); 101 tractori.setRentalDays (200); 102 tractori.setRentalRate(0.5); 103 System.out.println("******** TRACTOR 1 ****** "); 104 System.out.println(tractori.toString()); 105 //Create tractor object 2 106 Tractor tractor2=new Tractor ("KL523625", 0.8, 365); 107 System.out.println(" ******** TRACTOR 2 ****** "); 108 System.out.println("VIN: "+tractor2.getVehicleId()); 109 System.out.println("Rental Days: "+tractor2.getRentalDays()); 110 System.out.println("Rental Rate: "+tractor2.getRentalRate()); 111 System.out.println("Rental Profit: "+tractor2.getRentalProfit(); 112 //Create tractor object 3 113 Tractor tractor 3-new Tractor(); 114 tractor3.setVehicleId("KA586523"); Tractor.java Tractor.java Tractor (1).java 113 114 115 116 117 118 119 120 121 122 } Tractor tractor3=new Tractor(); tractor3.setVehicleId("KA586523"); tractor3.setRentalDays(-10); tractor3.setRentalRate(-0.5); System.out.println(" ******** TRACTOR 3 ****** "); System.out.println(tractor3.toString() ); } Tractor.java Tractor.java Tractor (1).java

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!