Question: JAVA Please Fork & clone my project that you have selected to work with. Inside the model package, create a POJO for any vehicle not
JAVA Please
Fork & clone my project that you have selected to work with.
Inside the model package, create a POJO for any vehicle not already created. Create 3 instance variables. Create a method called makeNoise that returns a string. Have the returned string from the method return the sound the vehicle makes.
After verifying that your object meets POJO protocol, VehicleNoise.java (contains the main method) and modify it (added to the bottom) to create an instance of your vehicle and print the results of the makeNoise method to the console.
VehicleNoise.java
| import model.Bus; |
| import model.Car; |
| import model.Minivan; |
| import model.Train; |
| import model.Motorcycle; |
| import model.MuscleCar; |
| import model.Aircraft; |
| import model.Bicycle; |
| import model.Limo; |
| import model.Truck; |
| import model.Unicycle; |
| public class VehicleNoise { |
| //add your vehicle class to the model package |
| //only push this file and the vehicle class you created |
| public static void main(String[] args) { |
| Car honda = new Car(); |
| System.out.println(honda.makeNoise()); |
| Minivan toyota = new Minivan(); |
| System.out.println(toyota.makeNoise()); |
| Bus bus = new Bus(); |
| System.out.println(bus.makeNoise()); |
| Aircraft helicopter = new Aircraft(); |
| System.out.println(helicopter.makeNoise()); |
| Train trainy = new Train(); |
| System.out.println(trainy.makeNoise()); |
| Motorcycle indian = new Motorcycle(); |
| System.out.println(indian.makeNoise()); |
| Limo convertibleLimo = new Limo(); |
| System.out.println(convertibleLimo.noise()); |
| Truck silverado = new Truck(); |
| System.out.println(silverado.makeNoise()); |
| Bicycle bike = new Bicycle(); |
| System.out.println(bike.makeNoise()); |
| MuscleCar dodgeChallenger = new MuscleCar(); |
| System.out.println(dodgeChallenger.makeNoise()); |
| Unicycle wheelie = new Unicycle(); |
| System.out.println(wheelie.makeNoise()); |
| } |
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
