Question: Main.java import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); BudgetRental budg = new BudgetRental(); int input

 Main.java import java.util.Scanner; public class Main { public static void main(String[]args) { Scanner scnr = new Scanner(System.in); BudgetRental budg = new BudgetRental();

Main.java

import java.util.Scanner;

public class Main {

public static void main(String[] args) { Scanner scnr = new Scanner(System.in); BudgetRental budg = new BudgetRental(); int input = scnr.nextInt(); scnr.nextLine(); //clears the buffer for (int i = 0; i

System.out.printf("%-5s %12s %7s ","-----","----------", "-----"); budg.printForward(); System.out.println(); System.out.println("\tData reversed"); budg.printBackward(); }

}

BudgetRental.java

public class BudgetRental {

private VehicleNode headNode; private VehicleNode tailNode;

public BudgetRental() { // Front and end of node list, the head and tail nodes don't store any data // and are known as dummy nodes headNode = new VehicleNode(); tailNode = new VehicleNode(); }

// TODO: Define the insertAtFront() method with the three needed parameters // that inserts a node at the front of the doubly linked list (after the dummy head node)

// TODO: Define the insertAtEnd() method with the three needed parameters // that inserts a node to the end of the doubly linked list (before the dummy tail node)

// TODO: Define the printInfo method to starts at the front of the list // and iterates through the list but excludes the dummy nodes

// TODO: Complete the printBackward method to starts at the tail of the list // and iterates through the list but excludes the dummy nodes

// The following two method are for the unit tests of the lab only public VehicleNode getHeadNext(){ return this.headNode.getNext(); } public VehicleNode getTailPrevious(){ return this.tailNode.getPrevious(); } }

VehicleNode.java

public class VehicleNode {

public void printNodeData() { System.out.printf("%-5s %7d %12s ", type, seats, color); } }

You will be writing the code the create a doubly linked list of vehicles. (1) Complete the VehicleNode class per the following specifications: Private class attributes o String type o int seats o String color o class reference for a next node o class reference for a previous node Public methods: o Constructors: empty and non-empty parameter list o setNext() setPrevious() o getNext() o getPrevious . o (2) Complete the four TODO's in the BudgetRental class insertAtFront(String, int, String) - (2 pts) insertAtEnd(String, int, String) - (2 pts) printForward printBackward0 (3) In the Main class, complete the two TODO sections to call the correct method and pass the arguments. When the input is: 6 SUV, 5, Black Sport, 2, Red Sedan, 4, Beige Truck, 3, Blue Van, 10, White SUV, 6, Green The output should be: Type # of seats color 6 3 SUV Truck Sport SUV Sedan 2 Green Blue Red Black Beige White 5 4 Van 10 Data reversed Van 10 Sedan 4 SUV 5 Sport 2 Truck 3 SUV 6 White Beige Black Red Blue Green

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!