SlideShare a Scribd company logo
1 of 15
Download to read offline
For the following questions, you will implement the data structure to store information used by a
local car dealer. Each car has some information and stored in a text files called cars: Write a
main program for all questions to let the user enter, delete, search for information, and print
current cars stored in the data structure. Cars formatted so car records separated by a blank line.
Each record contains (in order, each in a single line): Make (manufacturer). Model, Year,
Mileage, Price. Implement a double linked-list to store cars data. Write a double linked-list class
including search, delete, append (to the head and tail), and remove (from the head and tail).
Implement a FIFO queue of car data using the double linked-list. You can use the double linked
list you wrote in Q1. Implement a max-heap of cars data that can extract the car with the highest
price. Write a max-heap class including heapify, build heap, extract, and insertion. Implement a
binary search tree of car data. Write a BST class including search, insertion, and deletion.
Solution
Cars.java
package pacages;
public class Cars {
String make;
String model;
int year;
double mileage;
double price;
// Setters and getters for the Cars member variables
public String getMake() {
return make;
}
public void setMake(String make) {
this.make = make;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public double getMileage() {
return mileage;
}
public void setMileage(double mileage) {
this.mileage = mileage;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String toString()
{
return "Make: "+getMake()+ " Model: "+getModel()+ " Year: "+getYear() + "
Mileage: "+getMileage() + " Price: "+getPrice();
}
}
DoublyLinkedList.java
package pacages;
class Node
{
protected Cars data;
protected Node next, prev;
/* Constructor */
public Node()
{
next = null;
prev = null;
data = null;
}
/* Constructor */
public Node(Cars d, Node n, Node p)
{
data = d;
next = n;
prev = p;
}
/* Function to set link to next node */
public void setLinkNext(Node n)
{
next = n;
}
/* Function to set link to previous node */
public void setLinkPrev(Node p)
{
prev = p;
}
/* Funtion to get link to next node */
public Node getLinkNext()
{
return next;
}
/* Function to get link to previous node */
public Node getLinkPrev()
{
return prev;
}
/* Function to set data to node */
public void setData(Cars d)
{
data = d;
}
/* Function to get data from node */
public Cars getData()
{
return data;
}
}
/* Class linkedList */
public class DoublyLinkedList
{
protected Node start;
protected Node end ;
public int size;
/* Constructor */
public DoublyLinkedList()
{
start = null;
end = null;
size = 0;
}
/* Function to check if list is empty */
public boolean isEmpty()
{
return start == null;
}
/* Function to get size of list */
public int getSize()
{
return size;
}
/* Function to insert element at begining */
public void appendAtHead(Cars val)
{
Node nptr = new Node(val, null, null);
if(start == null)
{
start = nptr;
end = start;
}
else
{
start.setLinkPrev(nptr);
nptr.setLinkNext(start);
start = nptr;
}
size++;
}
/* Function to insert element at end */
public void appendAtTail(Cars val)
{
Node nptr = new Node(val, null, null);
if(start == null)
{
start = nptr;
end = start;
}
else
{
nptr.setLinkPrev(end);
end.setLinkNext(nptr);
end = nptr;
}
size++;
}
/* Function to remove element at end */
public void deleteAtTail()
{
end = end.getLinkPrev();
end.setLinkNext(null);
size-- ;
}
public void deleteAtHead()
{
start = start.getLinkNext();
start.setLinkPrev(null);
size--;
}
/* Function to display the list */
public void display()
{
if (size == 0)
{
System.out.print("empty ");
return;
}
if (start.getLinkNext() == null)
{
System.out.println(start.getData() );
return;
}
Node ptr = start;
System.out.print(start.getData()+ " ");
ptr = start.getLinkNext();
while (ptr.getLinkNext() != null)
{
System.out.print(ptr.getData()+ " ");
ptr = ptr.getLinkNext();
}
System.out.print(ptr.getData()+ "  ");
}
}
MaxHeap.java
package pacages;
public class MaxHeap
{
private Cars[] Heap;
private int size;
private int maxsize;
private static final int FRONT = 1;
public MaxHeap(int maxsize)
{
this.maxsize = maxsize;
this.size = 0;
Heap = new Cars[this.maxsize + 1];
Heap[0] = null;
}
private int parent(int pos)
{
return pos / 2;
}
private int leftChild(int pos)
{
return (2 * pos);
}
private int rightChild(int pos)
{
return (2 * pos) + 1;
}
private boolean isLeaf(int pos)
{
if (pos >= (size / 2) && pos <= size)
{
return true;
}
return false;
}
private void swap(int fpos,int spos)
{
Cars tmp;
tmp = Heap[fpos];
Heap[fpos] = Heap[spos];
Heap[spos] = tmp;
}
private void maxHeapify(int pos)
{
if (!isLeaf(pos))
{
if ( Heap[pos].getPrice() < Heap[leftChild(pos)].getPrice() || Heap[pos].getPrice() <
Heap[rightChild(pos)].getPrice())
{
if (Heap[leftChild(pos)].getPrice() > Heap[rightChild(pos)].getPrice())
{
swap(pos, leftChild(pos));
maxHeapify(leftChild(pos));
}else
{
swap(pos, rightChild(pos));
maxHeapify(rightChild(pos));
}
}
}
}
public void insertion(Cars car)
{
Heap[++size] = car;
int current = size-1;
if(size>2)
{
while(Heap[current].getPrice() > Heap[parent(current)].getPrice())
{
swap(current,parent(current));
current = parent(current);
}
}
}
public void maxHeap()
{
for (int pos = (size / 2); pos >= 1; pos--)
{
maxHeapify(pos);
}
}
public Cars extraction()
{
Cars popped = Heap[FRONT];
Heap[FRONT] = Heap[size--];
maxHeapify(FRONT);
return popped;
}
public void print()
{
for (int i = 1; i <= size / 2; i++ )
{
System.out.print(" PARENT : " + Heap[i] + " LEFT CHILD : " + Heap[2*i]
+ " RIGHT CHILD :" + Heap[2 * i + 1]);
System.out.println();
}
}
}
BST.java
package pacages;
public class BST {
Node root;
// Constructor
BST() {
root = null;
}
public Node search(Node root, Cars car)
{
// Base Cases: root is null or key is present at root
if (root==null || root.data.getMake().equals(car.getMake()))
{
if(root.data.getModel().equals(car.getModel()))
{
if(root.data.getYear() == car.getYear())
{
if(root.data.getMileage() == car.getMileage())
{
if(root.data.getPrice() == car.getPrice())
{
return root;
}
}
}
}
}
// val is greater than root's key
if (root.data.getPrice() > car.getPrice())
return search(root.prev, car);
// val is less than root's key
return search(root.next, car);
}
Node insert(Node root, Cars car) {
/* If the tree is empty, return a new node */
if (root == null) {
root = new Node(car, null, null);
return root;
}
/* Otherwise, recur down the tree */
if (car.getPrice() < root.data.getPrice())
root.prev = insert(root.prev, car);
else if (car.getPrice() > root.data.getPrice())
root.next = insert(root.next, car);
/* return the (unchanged) node pointer */
return root;
}
}
MyClass.java
package pacages;
import java.util.Scanner;
public class MyClass {
static DoublyLinkedList list = new DoublyLinkedList();
static MaxHeap heap = new MaxHeap(100);
static Scanner sc = new Scanner(System.in);
public static void main(String args[])
{
String choice = "y";
int menuChoice = 0;
do
{
System.out.println("MENU 1. Enter car Details 2. Delete Last car Data 3. Delete first
Car data 4. Display all Cars 5. Exit");
menuChoice = sc.nextInt();
switch(menuChoice)
{
case 1: getCarDetails();
break;
case 2: list.deleteAtTail();
break;
case 3: list.deleteAtHead();
heap.extraction();
break;
case 4: list.display();
}
System.out.println("Do you wish to continue? y or n");
choice = sc.next();
}while(choice.equals("y") || choice.equals("Y"));
}
public static void getCarDetails(){
Cars car = new Cars();
System.out.println("Enter Make: ");
car.setMake(sc.next());
System.out.println("Enter Model: ");
car.setModel(sc.next());
System.out.println("Enter Year: ");
car.setYear(sc.nextInt());
System.out.println("Enter Mileage: ");
car.setMileage(sc.nextDouble());
System.out.println("Enter Price: ");
car.setPrice(sc.nextDouble());
list.appendAtTail(car);
heap.insertion(car);
}
}
OUTPUT:
MENU
1. Enter car Details
2. Delete Last car Data
3. Delete first Car data
4. Display all Cars
5. Exit
1
Enter Make:
Hyundai
Enter Model:
324rtf
Enter Year:
2011
Enter Mileage:
30.0
Enter Price:
945677
Do you wish to continue? y or n
y
MENU
1. Enter car Details
2. Delete Last car Data
3. Delete first Car data
4. Display all Cars
5. Exit
1
Enter Make:
Toyota
Enter Model:
375jdg
Enter Year:
2005
Enter Mileage:
25.0
Enter Price:
673522
Do you wish to continue? y or n
y
MENU
1. Enter car Details
2. Delete Last car Data
3. Delete first Car data
4. Display all Cars
5. Exit
4
Make: Hyundai Model: 324rtf Year: 2011 Mileage: 30.0 Price: 945677.0
Make: Toyota Model: 375jdg Year: 2005 Mileage: 25.0 Price: 673522.0
Do you wish to continue? y or n
y
MENU
1. Enter car Details
2. Delete Last car Data
3. Delete first Car data
4. Display all Cars
5. Exit
2
Do you wish to continue? y or n
y
MENU
1. Enter car Details
2. Delete Last car Data
3. Delete first Car data
4. Display all Cars
5. Exit
4
Make: Hyundai Model: 324rtf Year: 2011 Mileage: 30.0 Price: 945677.0
Do you wish to continue? y or n
n

More Related Content

Similar to For the following questions, you will implement the data structure to.pdf

I need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdfI need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdfaggarwalshoppe14
 
This is the assignmentOBJECTIVESAfter finishing this lab, stude.pdf
This is the assignmentOBJECTIVESAfter finishing this lab, stude.pdfThis is the assignmentOBJECTIVESAfter finishing this lab, stude.pdf
This is the assignmentOBJECTIVESAfter finishing this lab, stude.pdfbharatchawla141
 
In C#, visual studio, I want no more text boxes added, I have button.pdf
In C#, visual studio, I want no more text boxes added, I have button.pdfIn C#, visual studio, I want no more text boxes added, I have button.pdf
In C#, visual studio, I want no more text boxes added, I have button.pdfaggarwalenterprisesf
 
The C# programming laguage delegates notes Delegates.pptx
The C# programming laguage delegates notes Delegates.pptxThe C# programming laguage delegates notes Delegates.pptx
The C# programming laguage delegates notes Delegates.pptxVitsRangannavar
 
CountryData.cppEDIT THIS ONE#include fstream #include str.pdf
CountryData.cppEDIT THIS ONE#include fstream #include str.pdfCountryData.cppEDIT THIS ONE#include fstream #include str.pdf
CountryData.cppEDIT THIS ONE#include fstream #include str.pdfAggarwalelectronic18
 
Goal The goal of this assignment is to help students understand the.pdf
Goal The goal of this assignment is to help students understand the.pdfGoal The goal of this assignment is to help students understand the.pdf
Goal The goal of this assignment is to help students understand the.pdfarsmobiles
 
(국비지원학원/재직자교육/실업자교육/IT실무교육_탑크리에듀)#4.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)
(국비지원학원/재직자교육/실업자교육/IT실무교육_탑크리에듀)#4.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)(국비지원학원/재직자교육/실업자교육/IT실무교육_탑크리에듀)#4.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)
(국비지원학원/재직자교육/실업자교육/IT실무교육_탑크리에듀)#4.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)탑크리에듀(구로디지털단지역3번출구 2분거리)
 
COMP360 Assembler Write an assembler that reads the source code of an.pdf
COMP360 Assembler Write an assembler that reads the source code of an.pdfCOMP360 Assembler Write an assembler that reads the source code of an.pdf
COMP360 Assembler Write an assembler that reads the source code of an.pdffazalenterprises
 
FedExPlanes7.txt1 medical 111 Boeing767 120000 London 3 packages.pdf
FedExPlanes7.txt1 medical 111 Boeing767 120000 London 3 packages.pdfFedExPlanes7.txt1 medical 111 Boeing767 120000 London 3 packages.pdf
FedExPlanes7.txt1 medical 111 Boeing767 120000 London 3 packages.pdfalukkasprince
 
Write a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdfWrite a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdfeyebolloptics
 
ONLY EDIT CapacityOptimizer.java, Simulator.java, and TriangularD.pdf
ONLY EDIT  CapacityOptimizer.java, Simulator.java, and TriangularD.pdfONLY EDIT  CapacityOptimizer.java, Simulator.java, and TriangularD.pdf
ONLY EDIT CapacityOptimizer.java, Simulator.java, and TriangularD.pdfvinodagrawal6699
 
Simple array Java code.The “Park-a-lot” parking garage currently o.pdf
Simple array Java code.The “Park-a-lot” parking garage currently o.pdfSimple array Java code.The “Park-a-lot” parking garage currently o.pdf
Simple array Java code.The “Park-a-lot” parking garage currently o.pdffasttracktreding
 
Angular2: Quick overview with 2do app example
Angular2: Quick overview with 2do app exampleAngular2: Quick overview with 2do app example
Angular2: Quick overview with 2do app exampleAlexey Frolov
 
Creating an Uber Clone - Part XXVI - Transcript.pdf
Creating an Uber Clone - Part XXVI - Transcript.pdfCreating an Uber Clone - Part XXVI - Transcript.pdf
Creating an Uber Clone - Part XXVI - Transcript.pdfShaiAlmog1
 

Similar to For the following questions, you will implement the data structure to.pdf (20)

29. Treffen - Tobias Meier - TypeScript
29. Treffen - Tobias Meier - TypeScript29. Treffen - Tobias Meier - TypeScript
29. Treffen - Tobias Meier - TypeScript
 
I need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdfI need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdf
 
This is the assignmentOBJECTIVESAfter finishing this lab, stude.pdf
This is the assignmentOBJECTIVESAfter finishing this lab, stude.pdfThis is the assignmentOBJECTIVESAfter finishing this lab, stude.pdf
This is the assignmentOBJECTIVESAfter finishing this lab, stude.pdf
 
In C#, visual studio, I want no more text boxes added, I have button.pdf
In C#, visual studio, I want no more text boxes added, I have button.pdfIn C#, visual studio, I want no more text boxes added, I have button.pdf
In C#, visual studio, I want no more text boxes added, I have button.pdf
 
The C# programming laguage delegates notes Delegates.pptx
The C# programming laguage delegates notes Delegates.pptxThe C# programming laguage delegates notes Delegates.pptx
The C# programming laguage delegates notes Delegates.pptx
 
Oop in java script
Oop in java scriptOop in java script
Oop in java script
 
CountryData.cppEDIT THIS ONE#include fstream #include str.pdf
CountryData.cppEDIT THIS ONE#include fstream #include str.pdfCountryData.cppEDIT THIS ONE#include fstream #include str.pdf
CountryData.cppEDIT THIS ONE#include fstream #include str.pdf
 
C# Programming Help
C# Programming HelpC# Programming Help
C# Programming Help
 
Goal The goal of this assignment is to help students understand the.pdf
Goal The goal of this assignment is to help students understand the.pdfGoal The goal of this assignment is to help students understand the.pdf
Goal The goal of this assignment is to help students understand the.pdf
 
Wien15 java8
Wien15 java8Wien15 java8
Wien15 java8
 
(국비지원학원/재직자교육/실업자교육/IT실무교육_탑크리에듀)#4.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)
(국비지원학원/재직자교육/실업자교육/IT실무교육_탑크리에듀)#4.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)(국비지원학원/재직자교육/실업자교육/IT실무교육_탑크리에듀)#4.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)
(국비지원학원/재직자교육/실업자교육/IT실무교육_탑크리에듀)#4.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)
 
COMP360 Assembler Write an assembler that reads the source code of an.pdf
COMP360 Assembler Write an assembler that reads the source code of an.pdfCOMP360 Assembler Write an assembler that reads the source code of an.pdf
COMP360 Assembler Write an assembler that reads the source code of an.pdf
 
JavaScript Core
JavaScript CoreJavaScript Core
JavaScript Core
 
FedExPlanes7.txt1 medical 111 Boeing767 120000 London 3 packages.pdf
FedExPlanes7.txt1 medical 111 Boeing767 120000 London 3 packages.pdfFedExPlanes7.txt1 medical 111 Boeing767 120000 London 3 packages.pdf
FedExPlanes7.txt1 medical 111 Boeing767 120000 London 3 packages.pdf
 
Write a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdfWrite a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdf
 
ONLY EDIT CapacityOptimizer.java, Simulator.java, and TriangularD.pdf
ONLY EDIT  CapacityOptimizer.java, Simulator.java, and TriangularD.pdfONLY EDIT  CapacityOptimizer.java, Simulator.java, and TriangularD.pdf
ONLY EDIT CapacityOptimizer.java, Simulator.java, and TriangularD.pdf
 
Simple array Java code.The “Park-a-lot” parking garage currently o.pdf
Simple array Java code.The “Park-a-lot” parking garage currently o.pdfSimple array Java code.The “Park-a-lot” parking garage currently o.pdf
Simple array Java code.The “Park-a-lot” parking garage currently o.pdf
 
Angular2: Quick overview with 2do app example
Angular2: Quick overview with 2do app exampleAngular2: Quick overview with 2do app example
Angular2: Quick overview with 2do app example
 
app.js.docx
app.js.docxapp.js.docx
app.js.docx
 
Creating an Uber Clone - Part XXVI - Transcript.pdf
Creating an Uber Clone - Part XXVI - Transcript.pdfCreating an Uber Clone - Part XXVI - Transcript.pdf
Creating an Uber Clone - Part XXVI - Transcript.pdf
 

More from arjunhassan8

Explain how substances get across membranes and into the cell.Sol.pdf
Explain how substances get across membranes and into the cell.Sol.pdfExplain how substances get across membranes and into the cell.Sol.pdf
Explain how substances get across membranes and into the cell.Sol.pdfarjunhassan8
 
Does yeast have a post translation pathway for protein synthesisIf .pdf
Does yeast have a post translation pathway for protein synthesisIf .pdfDoes yeast have a post translation pathway for protein synthesisIf .pdf
Does yeast have a post translation pathway for protein synthesisIf .pdfarjunhassan8
 
Determine whether the following statements about human ABO Wood group.pdf
Determine whether the following statements about human ABO Wood group.pdfDetermine whether the following statements about human ABO Wood group.pdf
Determine whether the following statements about human ABO Wood group.pdfarjunhassan8
 
Describe a similarity transformation that maps trapezoid WXYZ to tr.pdf
Describe a similarity transformation that maps trapezoid WXYZ to tr.pdfDescribe a similarity transformation that maps trapezoid WXYZ to tr.pdf
Describe a similarity transformation that maps trapezoid WXYZ to tr.pdfarjunhassan8
 
blackboard.ecu edu Take Test Exam ll-Blou2300601201730 he map above .pdf
blackboard.ecu edu Take Test Exam ll-Blou2300601201730 he map above .pdfblackboard.ecu edu Take Test Exam ll-Blou2300601201730 he map above .pdf
blackboard.ecu edu Take Test Exam ll-Blou2300601201730 he map above .pdfarjunhassan8
 
Bitcoin as an Ethical Dilemma closing case (Question below article).pdf
Bitcoin as an Ethical Dilemma closing case (Question below article).pdfBitcoin as an Ethical Dilemma closing case (Question below article).pdf
Bitcoin as an Ethical Dilemma closing case (Question below article).pdfarjunhassan8
 
2. This seasons flu virus is spreading based on a logistic functio.pdf
2. This seasons flu virus is spreading based on a logistic functio.pdf2. This seasons flu virus is spreading based on a logistic functio.pdf
2. This seasons flu virus is spreading based on a logistic functio.pdfarjunhassan8
 
^^^Q2. Discuss about Header Node    And also write a program fo.pdf
^^^Q2. Discuss about Header Node    And also write a program fo.pdf^^^Q2. Discuss about Header Node    And also write a program fo.pdf
^^^Q2. Discuss about Header Node    And also write a program fo.pdfarjunhassan8
 
Write the code segments to create a monitor that has the same behavi.pdf
Write the code segments to create a monitor that has the same behavi.pdfWrite the code segments to create a monitor that has the same behavi.pdf
Write the code segments to create a monitor that has the same behavi.pdfarjunhassan8
 
Which of the following is NOT a rationale for using mRNA intermed.pdf
Which of the following is NOT a rationale for using mRNA intermed.pdfWhich of the following is NOT a rationale for using mRNA intermed.pdf
Which of the following is NOT a rationale for using mRNA intermed.pdfarjunhassan8
 
Which elements are in series and which are in parallel in Figure P1.3.pdf
Which elements are in series and which are in parallel in Figure P1.3.pdfWhich elements are in series and which are in parallel in Figure P1.3.pdf
Which elements are in series and which are in parallel in Figure P1.3.pdfarjunhassan8
 
What domain is horizontal gene transfer most common within Multiple .pdf
What domain is horizontal gene transfer most common within Multiple .pdfWhat domain is horizontal gene transfer most common within Multiple .pdf
What domain is horizontal gene transfer most common within Multiple .pdfarjunhassan8
 
This problem is based on the B92 method of quantum key distri.pdf
This problem is based on the B92 method of quantum key distri.pdfThis problem is based on the B92 method of quantum key distri.pdf
This problem is based on the B92 method of quantum key distri.pdfarjunhassan8
 
The _ operator can be used to determine a variable address The variab.pdf
The _ operator can be used to determine a variable address The variab.pdfThe _ operator can be used to determine a variable address The variab.pdf
The _ operator can be used to determine a variable address The variab.pdfarjunhassan8
 
The main difference between passive and active transport is the spec.pdf
The main difference between passive and active transport is  the spec.pdfThe main difference between passive and active transport is  the spec.pdf
The main difference between passive and active transport is the spec.pdfarjunhassan8
 
The opposite movement of supination is ___. Pronation flexion exte.pdf
The opposite movement of supination is ___.  Pronation  flexion  exte.pdfThe opposite movement of supination is ___.  Pronation  flexion  exte.pdf
The opposite movement of supination is ___. Pronation flexion exte.pdfarjunhassan8
 
The latter or final stages of an RNA based heriditary world were lik.pdf
The latter or final stages of an RNA based heriditary world were lik.pdfThe latter or final stages of an RNA based heriditary world were lik.pdf
The latter or final stages of an RNA based heriditary world were lik.pdfarjunhassan8
 
The following table is a summary of randomly chosen student evaluati.pdf
The following table is a summary of randomly chosen student evaluati.pdfThe following table is a summary of randomly chosen student evaluati.pdf
The following table is a summary of randomly chosen student evaluati.pdfarjunhassan8
 
A female carrier of Tay-Sachs wants to have a child with a male carri.pdf
A female carrier of Tay-Sachs wants to have a child with a male carri.pdfA female carrier of Tay-Sachs wants to have a child with a male carri.pdf
A female carrier of Tay-Sachs wants to have a child with a male carri.pdfarjunhassan8
 
So I dont understand explicit equations. Whats the formula and how.pdf
So I dont understand explicit equations. Whats the formula and how.pdfSo I dont understand explicit equations. Whats the formula and how.pdf
So I dont understand explicit equations. Whats the formula and how.pdfarjunhassan8
 

More from arjunhassan8 (20)

Explain how substances get across membranes and into the cell.Sol.pdf
Explain how substances get across membranes and into the cell.Sol.pdfExplain how substances get across membranes and into the cell.Sol.pdf
Explain how substances get across membranes and into the cell.Sol.pdf
 
Does yeast have a post translation pathway for protein synthesisIf .pdf
Does yeast have a post translation pathway for protein synthesisIf .pdfDoes yeast have a post translation pathway for protein synthesisIf .pdf
Does yeast have a post translation pathway for protein synthesisIf .pdf
 
Determine whether the following statements about human ABO Wood group.pdf
Determine whether the following statements about human ABO Wood group.pdfDetermine whether the following statements about human ABO Wood group.pdf
Determine whether the following statements about human ABO Wood group.pdf
 
Describe a similarity transformation that maps trapezoid WXYZ to tr.pdf
Describe a similarity transformation that maps trapezoid WXYZ to tr.pdfDescribe a similarity transformation that maps trapezoid WXYZ to tr.pdf
Describe a similarity transformation that maps trapezoid WXYZ to tr.pdf
 
blackboard.ecu edu Take Test Exam ll-Blou2300601201730 he map above .pdf
blackboard.ecu edu Take Test Exam ll-Blou2300601201730 he map above .pdfblackboard.ecu edu Take Test Exam ll-Blou2300601201730 he map above .pdf
blackboard.ecu edu Take Test Exam ll-Blou2300601201730 he map above .pdf
 
Bitcoin as an Ethical Dilemma closing case (Question below article).pdf
Bitcoin as an Ethical Dilemma closing case (Question below article).pdfBitcoin as an Ethical Dilemma closing case (Question below article).pdf
Bitcoin as an Ethical Dilemma closing case (Question below article).pdf
 
2. This seasons flu virus is spreading based on a logistic functio.pdf
2. This seasons flu virus is spreading based on a logistic functio.pdf2. This seasons flu virus is spreading based on a logistic functio.pdf
2. This seasons flu virus is spreading based on a logistic functio.pdf
 
^^^Q2. Discuss about Header Node    And also write a program fo.pdf
^^^Q2. Discuss about Header Node    And also write a program fo.pdf^^^Q2. Discuss about Header Node    And also write a program fo.pdf
^^^Q2. Discuss about Header Node    And also write a program fo.pdf
 
Write the code segments to create a monitor that has the same behavi.pdf
Write the code segments to create a monitor that has the same behavi.pdfWrite the code segments to create a monitor that has the same behavi.pdf
Write the code segments to create a monitor that has the same behavi.pdf
 
Which of the following is NOT a rationale for using mRNA intermed.pdf
Which of the following is NOT a rationale for using mRNA intermed.pdfWhich of the following is NOT a rationale for using mRNA intermed.pdf
Which of the following is NOT a rationale for using mRNA intermed.pdf
 
Which elements are in series and which are in parallel in Figure P1.3.pdf
Which elements are in series and which are in parallel in Figure P1.3.pdfWhich elements are in series and which are in parallel in Figure P1.3.pdf
Which elements are in series and which are in parallel in Figure P1.3.pdf
 
What domain is horizontal gene transfer most common within Multiple .pdf
What domain is horizontal gene transfer most common within Multiple .pdfWhat domain is horizontal gene transfer most common within Multiple .pdf
What domain is horizontal gene transfer most common within Multiple .pdf
 
This problem is based on the B92 method of quantum key distri.pdf
This problem is based on the B92 method of quantum key distri.pdfThis problem is based on the B92 method of quantum key distri.pdf
This problem is based on the B92 method of quantum key distri.pdf
 
The _ operator can be used to determine a variable address The variab.pdf
The _ operator can be used to determine a variable address The variab.pdfThe _ operator can be used to determine a variable address The variab.pdf
The _ operator can be used to determine a variable address The variab.pdf
 
The main difference between passive and active transport is the spec.pdf
The main difference between passive and active transport is  the spec.pdfThe main difference between passive and active transport is  the spec.pdf
The main difference between passive and active transport is the spec.pdf
 
The opposite movement of supination is ___. Pronation flexion exte.pdf
The opposite movement of supination is ___.  Pronation  flexion  exte.pdfThe opposite movement of supination is ___.  Pronation  flexion  exte.pdf
The opposite movement of supination is ___. Pronation flexion exte.pdf
 
The latter or final stages of an RNA based heriditary world were lik.pdf
The latter or final stages of an RNA based heriditary world were lik.pdfThe latter or final stages of an RNA based heriditary world were lik.pdf
The latter or final stages of an RNA based heriditary world were lik.pdf
 
The following table is a summary of randomly chosen student evaluati.pdf
The following table is a summary of randomly chosen student evaluati.pdfThe following table is a summary of randomly chosen student evaluati.pdf
The following table is a summary of randomly chosen student evaluati.pdf
 
A female carrier of Tay-Sachs wants to have a child with a male carri.pdf
A female carrier of Tay-Sachs wants to have a child with a male carri.pdfA female carrier of Tay-Sachs wants to have a child with a male carri.pdf
A female carrier of Tay-Sachs wants to have a child with a male carri.pdf
 
So I dont understand explicit equations. Whats the formula and how.pdf
So I dont understand explicit equations. Whats the formula and how.pdfSo I dont understand explicit equations. Whats the formula and how.pdf
So I dont understand explicit equations. Whats the formula and how.pdf
 

Recently uploaded

Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 

Recently uploaded (20)

Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 

For the following questions, you will implement the data structure to.pdf

  • 1. For the following questions, you will implement the data structure to store information used by a local car dealer. Each car has some information and stored in a text files called cars: Write a main program for all questions to let the user enter, delete, search for information, and print current cars stored in the data structure. Cars formatted so car records separated by a blank line. Each record contains (in order, each in a single line): Make (manufacturer). Model, Year, Mileage, Price. Implement a double linked-list to store cars data. Write a double linked-list class including search, delete, append (to the head and tail), and remove (from the head and tail). Implement a FIFO queue of car data using the double linked-list. You can use the double linked list you wrote in Q1. Implement a max-heap of cars data that can extract the car with the highest price. Write a max-heap class including heapify, build heap, extract, and insertion. Implement a binary search tree of car data. Write a BST class including search, insertion, and deletion. Solution Cars.java package pacages; public class Cars { String make; String model; int year; double mileage; double price; // Setters and getters for the Cars member variables public String getMake() { return make; } public void setMake(String make) { this.make = make; } public String getModel() { return model; } public void setModel(String model) { this.model = model; }
  • 2. public int getYear() { return year; } public void setYear(int year) { this.year = year; } public double getMileage() { return mileage; } public void setMileage(double mileage) { this.mileage = mileage; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public String toString() { return "Make: "+getMake()+ " Model: "+getModel()+ " Year: "+getYear() + " Mileage: "+getMileage() + " Price: "+getPrice(); } } DoublyLinkedList.java package pacages; class Node { protected Cars data; protected Node next, prev; /* Constructor */ public Node() {
  • 3. next = null; prev = null; data = null; } /* Constructor */ public Node(Cars d, Node n, Node p) { data = d; next = n; prev = p; } /* Function to set link to next node */ public void setLinkNext(Node n) { next = n; } /* Function to set link to previous node */ public void setLinkPrev(Node p) { prev = p; } /* Funtion to get link to next node */ public Node getLinkNext() { return next; } /* Function to get link to previous node */ public Node getLinkPrev() { return prev; } /* Function to set data to node */ public void setData(Cars d) { data = d; }
  • 4. /* Function to get data from node */ public Cars getData() { return data; } } /* Class linkedList */ public class DoublyLinkedList { protected Node start; protected Node end ; public int size; /* Constructor */ public DoublyLinkedList() { start = null; end = null; size = 0; } /* Function to check if list is empty */ public boolean isEmpty() { return start == null; } /* Function to get size of list */ public int getSize() { return size; } /* Function to insert element at begining */ public void appendAtHead(Cars val) { Node nptr = new Node(val, null, null); if(start == null)
  • 5. { start = nptr; end = start; } else { start.setLinkPrev(nptr); nptr.setLinkNext(start); start = nptr; } size++; } /* Function to insert element at end */ public void appendAtTail(Cars val) { Node nptr = new Node(val, null, null); if(start == null) { start = nptr; end = start; } else { nptr.setLinkPrev(end); end.setLinkNext(nptr); end = nptr; } size++; } /* Function to remove element at end */ public void deleteAtTail() { end = end.getLinkPrev(); end.setLinkNext(null); size-- ;
  • 6. } public void deleteAtHead() { start = start.getLinkNext(); start.setLinkPrev(null); size--; } /* Function to display the list */ public void display() { if (size == 0) { System.out.print("empty "); return; } if (start.getLinkNext() == null) { System.out.println(start.getData() ); return; } Node ptr = start; System.out.print(start.getData()+ " "); ptr = start.getLinkNext(); while (ptr.getLinkNext() != null) { System.out.print(ptr.getData()+ " "); ptr = ptr.getLinkNext(); } System.out.print(ptr.getData()+ " "); } }
  • 7. MaxHeap.java package pacages; public class MaxHeap { private Cars[] Heap; private int size; private int maxsize; private static final int FRONT = 1; public MaxHeap(int maxsize) { this.maxsize = maxsize; this.size = 0; Heap = new Cars[this.maxsize + 1]; Heap[0] = null; } private int parent(int pos) { return pos / 2; } private int leftChild(int pos) { return (2 * pos); } private int rightChild(int pos) { return (2 * pos) + 1; } private boolean isLeaf(int pos) { if (pos >= (size / 2) && pos <= size)
  • 8. { return true; } return false; } private void swap(int fpos,int spos) { Cars tmp; tmp = Heap[fpos]; Heap[fpos] = Heap[spos]; Heap[spos] = tmp; } private void maxHeapify(int pos) { if (!isLeaf(pos)) { if ( Heap[pos].getPrice() < Heap[leftChild(pos)].getPrice() || Heap[pos].getPrice() < Heap[rightChild(pos)].getPrice()) { if (Heap[leftChild(pos)].getPrice() > Heap[rightChild(pos)].getPrice()) { swap(pos, leftChild(pos)); maxHeapify(leftChild(pos)); }else { swap(pos, rightChild(pos)); maxHeapify(rightChild(pos)); } } } } public void insertion(Cars car) {
  • 9. Heap[++size] = car; int current = size-1; if(size>2) { while(Heap[current].getPrice() > Heap[parent(current)].getPrice()) { swap(current,parent(current)); current = parent(current); } } } public void maxHeap() { for (int pos = (size / 2); pos >= 1; pos--) { maxHeapify(pos); } } public Cars extraction() { Cars popped = Heap[FRONT]; Heap[FRONT] = Heap[size--]; maxHeapify(FRONT); return popped; } public void print() { for (int i = 1; i <= size / 2; i++ ) { System.out.print(" PARENT : " + Heap[i] + " LEFT CHILD : " + Heap[2*i]
  • 10. + " RIGHT CHILD :" + Heap[2 * i + 1]); System.out.println(); } } } BST.java package pacages; public class BST { Node root; // Constructor BST() { root = null; } public Node search(Node root, Cars car) { // Base Cases: root is null or key is present at root if (root==null || root.data.getMake().equals(car.getMake())) { if(root.data.getModel().equals(car.getModel())) { if(root.data.getYear() == car.getYear()) { if(root.data.getMileage() == car.getMileage()) { if(root.data.getPrice() == car.getPrice()) { return root; } } } } } // val is greater than root's key if (root.data.getPrice() > car.getPrice())
  • 11. return search(root.prev, car); // val is less than root's key return search(root.next, car); } Node insert(Node root, Cars car) { /* If the tree is empty, return a new node */ if (root == null) { root = new Node(car, null, null); return root; } /* Otherwise, recur down the tree */ if (car.getPrice() < root.data.getPrice()) root.prev = insert(root.prev, car); else if (car.getPrice() > root.data.getPrice()) root.next = insert(root.next, car); /* return the (unchanged) node pointer */ return root; } } MyClass.java package pacages; import java.util.Scanner; public class MyClass { static DoublyLinkedList list = new DoublyLinkedList(); static MaxHeap heap = new MaxHeap(100); static Scanner sc = new Scanner(System.in); public static void main(String args[]) { String choice = "y";
  • 12. int menuChoice = 0; do { System.out.println("MENU 1. Enter car Details 2. Delete Last car Data 3. Delete first Car data 4. Display all Cars 5. Exit"); menuChoice = sc.nextInt(); switch(menuChoice) { case 1: getCarDetails(); break; case 2: list.deleteAtTail(); break; case 3: list.deleteAtHead(); heap.extraction(); break; case 4: list.display(); } System.out.println("Do you wish to continue? y or n"); choice = sc.next(); }while(choice.equals("y") || choice.equals("Y")); } public static void getCarDetails(){ Cars car = new Cars(); System.out.println("Enter Make: "); car.setMake(sc.next()); System.out.println("Enter Model: "); car.setModel(sc.next()); System.out.println("Enter Year: "); car.setYear(sc.nextInt()); System.out.println("Enter Mileage: "); car.setMileage(sc.nextDouble()); System.out.println("Enter Price: ");
  • 13. car.setPrice(sc.nextDouble()); list.appendAtTail(car); heap.insertion(car); } } OUTPUT: MENU 1. Enter car Details 2. Delete Last car Data 3. Delete first Car data 4. Display all Cars 5. Exit 1 Enter Make: Hyundai Enter Model: 324rtf Enter Year: 2011 Enter Mileage: 30.0 Enter Price: 945677 Do you wish to continue? y or n y MENU 1. Enter car Details 2. Delete Last car Data 3. Delete first Car data 4. Display all Cars 5. Exit 1 Enter Make: Toyota Enter Model: 375jdg
  • 14. Enter Year: 2005 Enter Mileage: 25.0 Enter Price: 673522 Do you wish to continue? y or n y MENU 1. Enter car Details 2. Delete Last car Data 3. Delete first Car data 4. Display all Cars 5. Exit 4 Make: Hyundai Model: 324rtf Year: 2011 Mileage: 30.0 Price: 945677.0 Make: Toyota Model: 375jdg Year: 2005 Mileage: 25.0 Price: 673522.0 Do you wish to continue? y or n y MENU 1. Enter car Details 2. Delete Last car Data 3. Delete first Car data 4. Display all Cars 5. Exit 2 Do you wish to continue? y or n y MENU 1. Enter car Details 2. Delete Last car Data 3. Delete first Car data 4. Display all Cars 5. Exit 4 Make: Hyundai Model: 324rtf Year: 2011 Mileage: 30.0 Price: 945677.0
  • 15. Do you wish to continue? y or n n