Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Java Eclipse project named lastfirstL01, replacing last and first with your name. Unless otherwise stated, each object should be alone in a file.

Create a Java Eclipse project named lastfirstL01, replacing last and first with your name. Unless otherwise stated, each object should be alone in a file. Remember: You must use methods effectively to avoid duplicating code. Be sure to zip and submit the entire project.

  • Do not use inheritance or polymorphism in this lab, except in the case of implementing interfaces
  • Variables should be private
  • Create a package to hold objects associated with vehicles
    • Vehicle objects have
      • Number of doors
      • Odometer for the number of miles driven
      • Registration object (see below)
      • Model Information object (see below)
      • Has only one constructor
        • Sets the doors to an argument passed into this constructor
        • Sets the miles driven to 0
        • Creates a random integer for a vehicle identification number (VIN)
          • Do not worry about duplicate numbers for this assignment
        • Instantiates the Model Information
          • Uses arguments passed into this constructor for make, model, and year
        • Instantiates the Registration
          • Passes the VIN to its constructor
      • Has an accessor for the number of doors
      • Has an accessor and mutator for miles driven
        • The mutator will add the miles passed-in by argument to the odometer
        • Miles can never be subtracted from the odometer
      • Has an accessor that returns the Model Information object
      • Has an accessor that returns the Registration object
      • Has a mutator that will change the Registration object using passed-in arguments for
        • License plate number
        • Current owner
        • Tax due
        • Tax due date
      • You should not need additional mutators for this object because once set, these values should never be changed:
        • Number of doors
        • VIN (except in the case of cloningsee below)
        • Make
        • Model
        • Year
      • Properly overridden toString() method to return Vehicle, Registration, and Model Information
        • I am not too worried about formatting it as long as it is easily readable
        • Odometers are limited to 1 decimal place
        • You should use the Registration and Model Information toString() methods
      • Properly overridden equals() method that checks for instance of Vehicle, object references, and the VIN number
      • Properly overridden compareTo() method using the VIN for comparison
        • This should result in Collections.sort sorting it in ascending order by VIN number
      • Properly overridden clone() method that performs a deep copy
        • The clone method should give the cloned object a different random VIN
        • Do not worry about duplicate numbers; generate and assign a new random number
      • Vehicles will implement the Vehicle Interface (see below)
    • Registration objects have
      • VIN an integer
      • License plate number a string of 7 uppercase letters and numbers
      • Current owner name holds string for a named formatted as last, first
      • Tax due - double
      • Tax due date holds a string formatted as YYYY-MM-DD
      • Has only one constructor
        • Sets VIN to a value passed in as an argument
        • Sets the plate number to null
        • Sets the owner name to null
        • Sets the tax due to 0.0
        • Sets the tax due date to null
      • Accessors and mutators for license plate number, owner, tax due, tax due date
      • Accessor only for VIN
      • You should not need additional accessors or mutators
      • Properly overridden toString() method to return Registration information
        • I am not too worried about formatting it as long as it is easily readable
      • Registration objects implement the Registration Interface (see below)
    • Model Information objects have
      • Make (e.g., Ford)
      • Model (e.g., Mustang)
      • Year (e.g., 2021)
      • Has only one constructor that sets class members to passed in arguments
      • Accessors only for Make, Model, and Year
      • You should not need additional accessors or mutators
      • Properly overridden toString() method to return Model Information
        • I am not too worried how you format it as long as it is easily readable
    • Interfaces
      • Vehicle Interface forces vehicles to have the described accessors and mutators
      • Registration Interface forces registration objects to have the described accessors and mutators
      • Model Interface forces model objects to have the described accessors
  • Create a package for the driver program
    • Create a class with a main method
    • The main method
      • Instantiates a Vehicle object and place it into an array list
      • Create 9 clones of the Vehicle using a loop, placing all of them into the array list
      • Use Collections.sort to sort the vehicles
      • Print the sorted list by having System.out.println automatically use the toString() method

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions