Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

implement a data base of object dataBaseRecord with values of first name, last name, and a 5 digit ID number read in from a file

implement a data base of object dataBaseRecord with values of first name, last name, and a 5 digit ID number read in from a file that the user will be asked for. implement this using a double linked, double ended, sorted linked list. there is a photo of the driver code for this program and it may not be changed. the goal is to create a program that can add, delete and find objects in this database. along with this it can display the objects in the database in id ascending and descending, first name ascending and descending, and last name ascending and descending order. to list the objects in each of these orders you should use an object index with key and where being the values inside. key is the first name, last name, or ID depending on how the user would like to order it, and where is which node the key is from in the main data base. these three double linked lists (class named indexes) first name, last name, and ID will be maintained in order as you insert or delete value from them. no duplicate ID values should be allowed and the entire object with the duplicate id should be disregarded.
5 classes in total should be in the program
indexRecord.java(object with key and where values)
index.java(double linked lists of indexRecord objects)
dataBase.java(double linked list of dataBaseRecord objects)
dataBaseRecord.java(object with first name, last name, and ID values)
Driver.java
image text in transcribed
image text in transcribed
import java.util.*; public class Driver { public static void main(String[] args) { /*The following declaration declares a data structure that will change from one assignment to the next. For example, you will need to implement * the following as a doubly linked list, as well as a tree. */ DataBase d=new DataBase(); int response; Scanner keyboard=new Scanner(System.in); /* Read the data into the database from the external disk file here * IMPORTANT: duplicate ID numbers should not be added. Disregard * the entire record for duplicate IDs */ do { System.out.println(" 1 Add a new student"); System.out.println(" 2 Delete a student"); System.out.println(" 3 Find a student by ID"); System.out.println(" 4 List students by ID increasing"); System.out.println(" 5 List students by first name increasing"); System.out.println(" 6 List students by last name increasing"); System.out.println(" 7 List students by ID decreasing"); System.out.println(" 8 List students by first name decreasing"); System.out.println(" 9 List students by last name decreasing"); System.out.println(" "); System.out.println(" 0 End"); response=keyboard.nextInt(); switch (response) { case 1: d.addIt(); //Note: if the user enters an ID already in use, issue a warning and return to the menu break; case 2: d.deleteIt(); //Note: output either "Deleted" or "ID not Found" and return to menu break; case 3: d.findIt(); //Note: output the entire record or the message "ID not Found" and return to menu break; case 4: d.ListByIDAscending(); break; case 5: d.ListByFirstAscending(); break; case 6: d.ListByLastAscending(); break; case 7: d.ListByIDDescending(); break; case 8: d.ListByFirstDescending(); break; case 9: d.ListByLastDescending(); break; default: } } while (response!=0); } }
import java.util. :1 public class Drives { public static void main(string[] args) { /*The following declaration declares a data structure that will change from one assignment to the next. For example, you will need to implement * the following as a doubly linked list, as well as a tree. Database denew Database(); int response; Scanner keyboardenew Scanner(System.in); /* Read the data into the database from the external disk file here * IMPORTANT: duplicate ID numbers should not be added. Disregard the entire record for duplicate IDs do { System.out.println(" 1 Add a new student"); System.out.println(" 2 Delete a student"); System.out.println(" 3 Find a student by ID"); System.out.println(" 4 List students by ID increasing"); System.out.println(" 5 List students by first name increasing"); System.out.println(" 6 List students by last name increasing"); System.out.println(" 7 list students by ID decreasing"); System.out.println(" & List students by first name decreasing"); System.out.println(" 9 List students by last name decreasing"); System.out.println(" "); System.out.println("End"); response-keyboard.nextInt(); switch (response) case 1: d.addit(); //Note: if the user enters an ID already in use, Issue a warning and return to the menu break; case 2: d.deleteIt(); 1/Note: output either "Deleted" or "ID not Found" and return to menu break; case 3: d.findit(); //Note: output the entire record or the message "ID not Found" and return to menu break; case 41 d. ListByIDAscending(); break; case 5: d.ListbyFirstAscending(); break; case 6: d.ListByLastAscending(); break; case 7: d. ListyIDDescending(); breaks case B1 d. ListhyFirstDescending(); break; case 9: d.ListByLastDescending() break; Database denew Database(); int response; Scanner keyboard=new Scanner(System.in); /" Read the data into the database from the external disk file here IMPORTANT: duplicate ID numbers should not be added. Disregard the entire record for duplicate IDs */ do System.out.println(" 1 Add a new student"); System.out.println(" 2 Delete a student"); System.out.println(" 3 Find a student by ID"); System.out.println(" 4 List students by ID increasing"); System.out.println(" s List students by first name increasing"); System.out.println(" 6 List students by last name increasing"); System.out.println(" 7 List students by ID decreasing"); System.out.println(" & List students by first name decreasing"); System.out.println(" 9 List students by last name decreasing"); System.out.println(" "); System.out.println("End"); response-keyboard.nextInt(); switch (response) { case 1: d.addit(); //Note: if the user enters an ID already in use, issue a warning and return to the menu break; case 2: d.deleteit(); 1/Note: output either "Deleted" or "ID not Found" and return to menu break; case 3: d.findit(); //Note: output the entire record or the message "ID not Found" and return to menu break; case 4: d.ListByIDAscending(); break; case S. d.ListByFirstAscending(); I break; case 61 d. ListeyLastAscending(); breaks case 7: d. ListByIDDescending(); break; case 8: d. ListByFirstDescending(); breaks case 9: d.ListByLastDescending(); breaks defaults } while (responsel); import java.util. :1 public class Drives { public static void main(string[] args) { /*The following declaration declares a data structure that will change from one assignment to the next. For example, you will need to implement * the following as a doubly linked list, as well as a tree. Database denew Database(); int response; Scanner keyboardenew Scanner(System.in); /* Read the data into the database from the external disk file here * IMPORTANT: duplicate ID numbers should not be added. Disregard the entire record for duplicate IDs do { System.out.println(" 1 Add a new student"); System.out.println(" 2 Delete a student"); System.out.println(" 3 Find a student by ID"); System.out.println(" 4 List students by ID increasing"); System.out.println(" 5 List students by first name increasing"); System.out.println(" 6 List students by last name increasing"); System.out.println(" 7 list students by ID decreasing"); System.out.println(" & List students by first name decreasing"); System.out.println(" 9 List students by last name decreasing"); System.out.println(" "); System.out.println("End"); response-keyboard.nextInt(); switch (response) case 1: d.addit(); //Note: if the user enters an ID already in use, Issue a warning and return to the menu break; case 2: d.deleteIt(); 1/Note: output either "Deleted" or "ID not Found" and return to menu break; case 3: d.findit(); //Note: output the entire record or the message "ID not Found" and return to menu break; case 41 d. ListByIDAscending(); break; case 5: d.ListbyFirstAscending(); break; case 6: d.ListByLastAscending(); break; case 7: d. ListyIDDescending(); breaks case B1 d. ListhyFirstDescending(); break; case 9: d.ListByLastDescending() break; Database denew Database(); int response; Scanner keyboard=new Scanner(System.in); /" Read the data into the database from the external disk file here IMPORTANT: duplicate ID numbers should not be added. Disregard the entire record for duplicate IDs */ do System.out.println(" 1 Add a new student"); System.out.println(" 2 Delete a student"); System.out.println(" 3 Find a student by ID"); System.out.println(" 4 List students by ID increasing"); System.out.println(" s List students by first name increasing"); System.out.println(" 6 List students by last name increasing"); System.out.println(" 7 List students by ID decreasing"); System.out.println(" & List students by first name decreasing"); System.out.println(" 9 List students by last name decreasing"); System.out.println(" "); System.out.println("End"); response-keyboard.nextInt(); switch (response) { case 1: d.addit(); //Note: if the user enters an ID already in use, issue a warning and return to the menu break; case 2: d.deleteit(); 1/Note: output either "Deleted" or "ID not Found" and return to menu break; case 3: d.findit(); //Note: output the entire record or the message "ID not Found" and return to menu break; case 4: d.ListByIDAscending(); break; case S. d.ListByFirstAscending(); I break; case 61 d. ListeyLastAscending(); breaks case 7: d. ListByIDDescending(); break; case 8: d. ListByFirstDescending(); breaks case 9: d.ListByLastDescending(); breaks defaults } while (responsel)

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

Intelligent Information And Database Systems Third International Conference Achids 2011 Daegu Korea April 2011 Proceedings Part 2 Lnai 6592

Authors: Ngoc Thanh Nguyen ,Chong-Gun Kim ,Adam Janiak

2011th Edition

3642200419, 978-3642200410

More Books

Students also viewed these Databases questions