logo

Vehicle Data Inventory System

Ipsum lorem vei illum sat dolor euis mod tincidunt vei auminiure dolor in esse.

18 Pages2151 Words53 Views
   

Added on  2022-12-28

About This Document

This program implements a Vehicle Inventory using Linked Lists. It covers the understanding of Java generics, encapsulation, and abstraction and data structures. The program uses a sorted linked list to store and sort vehicle objects based on their miles per gallon value.

Vehicle Data Inventory System

Ipsum lorem vei illum sat dolor euis mod tincidunt vei auminiure dolor in esse.

   Added on 2022-12-28

ShareRelated Documents
Running head: Vehicle Data Inventory System 1
Vehicle Data Inventory System
Name
Course
Professor
Date
Vehicle Data Inventory System_1
Vehicle Data Inventory System 2
Vehicle Data Linked List
Their Vehicle Data Linked List program uses generics and data structure implementation
for a linked list to implement a Vehicle Inventory using Linked Lists. This topic covers the
understanding of Java generics, encapsulation, and abstraction and data structures. They have
implemented their own sorted linked list in this application.
They have used a Node class which will store a single node of the linked list. This node
class will store an address to the next node and an Object element of type vehicle. A linked list
will be formed as they will insert various vehicle objects in the list.
Completed Program
Node.java
public class Node<E> {
private E data;
private Node<E> next;
public E getData() {
return data;
}
public Node<E> getNext() {
Vehicle Data Inventory System_2
Vehicle Data Inventory System 3
return next;
}
public Node(E e) {
super();
this.data = e;
}
public void setData(E data) {
this.data = data;
}
public void setNext(Node<E> next) {
this.next = next;
}
public String toString()
{
return this.data.toString();
}
}
Vehicle Data Inventory System_3
Vehicle Data Inventory System 4
Vehicle.java
public class Vehicle implements Comparable<Vehicle>{
private String make;
private String model;
private double miles_per_gallon;
public String getMake() {
return make;
}
public String getModel() {
return model;
}
public double getMiles_per_gallon() {
return miles_per_gallon;
}
public Vehicle(String make, String model, double miles_per_gallon) {
super();
Vehicle Data Inventory System_4

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Data Structures and Algorithms: Linked List Implementation for Student Records
|2
|862
|210

CarYardMIT162011 Class Implementation in Java
|6
|1107
|393

Design Documentation Pseudo Code BEGIN Display Welcome message BEGIN
|13
|1512
|68