Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ASSIGNMENT 4 Linked List Implementation The purpose of this assignment is to get familiar with the linked list. Create a project called Assignment 4. You

image text in transcribedimage text in transcribed

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

ASSIGNMENT 4 Linked List Implementation The purpose of this assignment is to get familiar with the linked list. Create a project called Assignment 4. You will then write four classes: Assignment4.java - A driver class that contains only a main method which should: Create a new CustomerList object Prompt the user to enter a file name Call the getCustomerList() method with the file name that the user entered While (true) { Prompt user to enter command; if (command is "a") { Prompt user for customerNumber firstName lastName balance; Create a new CustomerList object Prompt the user to enter a file name Call the getCustomerList() method with the file name that the user entered While (true) { Prompt user to enter command; if (command is "a") { Prompt user for customerNumber firstName lastName balance; Create a customerRecord and inserts the customer record at the head of a singly linked list; } else if (command is "f") { Prompt the user to enter a customer number and then displays the corresponding record on the screen; } else if(command is d){ Delete the first customer record from the singly linked list. } else if(command is r){ Prompt the user to enter a customer number; Delete the given customer record corresponding to the customer number from the singly linked list; If the customer number does not exist, please show the error message; } else if(command is n) { } else if(command is n){ Call getTotalCustomer Number() method and then displays the total number of customers in the database on the screen else if (command is "q") { Prompt the user to enter a file name to save the latest update; Save the information in the database to the file specified by the user; Terminate program; } else { Display error message; } } customerList.java - This class contains a singly linked list of customerRecord objects. It should have the following data attributes and methods: public class customerList{ private Node head; /*this is the reference variable to the first node of linked list* / public customerList() - build the list object public void getCustomerList(String fileName) reads a textfile and fills the linked list with the records from the file. public customerRecord getCustomerRecord(int customerNumber) returns the object corresponding to the customer with specified customer number. If the customer number is not in the linked list, return null. (check search function) public void enterCustomerRecord(customerRecord new record) inserts the customer record at the head public customerRecord getCustomerRecord(int customerNumber) returns the object corresponding to the customer with specified customer number. If the customer number is not in the linked list, return null. (check search function) public void enterCustomerRecord(customerRecord new record) - inserts the customer record at the head of a singly linked list (check insert function) public void removeFirstCustomerRecord () - delete the first customer record from the linked list (check removeFirstNode) public int getTotalCustomerNumber() counts the number of customers in a singly linked list. public void saveCustermer List(String filename) save the information stored in the linked list to the file called filename public void removeCustomerRecord(int customerNumber) - delete the given customer record corresponding to the customer number from the linked list. If the customer number does not exist, please show the error message. (check removeNode) Node.java /** Node of a singly linked list of customerRecord. */ public class Node { private customerRecord element; private Node next; /** Creates a node with the given element and next node. */ public Node(customerRecord s) { element = s; next = null; } /** Returns the element of this node. */ public customerRecord getElement( { return element; } /** Returns the next node of this node. */ public Node getNext() { return next; } public Node getNext( { return next; } // Modifier methods: /** Sets the element of this node. */ public void setElement(customerRecord newElem) element = newElem; } /** Sets the next node of this node. */ public void setNext(Node newNext) { next = newNext; } customerRecord.java a class that contains the following data attributes and methods: private int customerNumber - a unique number assigned to each customer private String firstName - the customer's first name private String lastName the customer's last name private float balance - the customer's balance get/set Methods for each data attribute customerRecord.java - a class that contains the following data attributes and methods: private int customerNumber - a unique number assigned to each customer private String firstName the customer's first name private String lastName - the customer's last name private float balance - the customer's balance get/set Methods for each data attribute public String toString() - Special method to be used when printing a customerRecord object

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

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

Proficiency with Microsoft Word, Excel, PowerPoint

Answered: 1 week ago

Question

Experience with SharePoint and/or Microsoft Project desirable

Answered: 1 week ago