Question: Design a class, Magazine that implements Comparable interface and has the following class variables: int magazineID String magazineName String publisherName Implement a suitable constructors and
Design a class, Magazine that implements Comparable interface and has the following class variables: int magazineID String magazineName String publisherName
Implement a suitable constructors and a print function that prints the ID, then the 2 strings data types (magazineName and publisherName) on separate lines, followed by a blank line. Add any access and other functions you need.
Design a linked list class, MagazineList, to hold objects of the type Magazine. The linked list class must implement at least the following member functions:
MagazineList(); // constructor
void makeEmpty(); //empties the linked list
Magazine findID(int ID); // dont remove the object // return null if the list is empty or ID not found
boolean insertAtFront(Magazine mag); // insert at front of list or return // false if that ID already exists
Magazine deleteFromFront(); // delete and return the record at the front of the list or return null if the list is empty
boolean delete(int ID); // find and delete the record with the given ID or return false if it isnt found boolean printRecord(int ID); // print that object as above for Magazine
void printAllRecords(); // print all elements in the order they appear in the linked list. Do nothing if the list is empty
Your program must read from the keyboard and print to the screen.
Please write a main function that will print the list of operations for the user and allow the user to do all the functions in the MagazineList class.
Sample run
:
Operations on List
1. Make Empty
2. Find ID
3. Insert At Front
4. Delete From Front
5. Delete ID
6. Print ID
7. Print All Records
8. Done
Your choice : 3
Enter Magazine ID : 1111
Enter Magazine Name : People
Enter Publisher Name : People
...
Magazine Added
Operations on List
1. Make Empty
2. Find ID
3. Insert At Front
4. Delete From Front
5. Delete ID
6. Print ID
7. Print All Records
8. Done
Your Choice : 2
ID No : 1111
1111
People People
Operations on List
1. Make Empty
2. Find ID
3. Insert At Front
4. Delete From Front
5. Delete ID
6. Print ID
7. Print All Records
8. Done
Your Choice: 4
First item deleted
Operations on List
1. Make Empty
2. Find ID
3. Insert At Front
4. Delete From Front
5. Delete ID
6. Print ID
7. Print All Records
8. Done
Your Choice: 8
Done.
etc
Make sure your source file has your name as a comment at the top. Include a README.txt file explaining the IDE/compiler that you used, and a statement of what works and what doesnt work. Zip your files into one file before submitting. Use good style and layout and comment your code well. For Zip file use the following naming convention FirstInitial_FullLastName_courseID_sectionNumber.zip
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
