Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I don't need help with the exceptions. But if its necessary, these exception classes both have a no-parameter constructor, which just calls the corresponding superclass

I don't need help with the exceptions. But if its necessary, these exception classes both have a no-parameter constructor, which just calls the corresponding superclass constructor.

image text in transcribed

This is my HelpTicket class

image text in transcribed

TASK: Now that we have written some custom exceptions to handle some issues we might face when the user creates a new node, we can start building the components of our Linked List. Write a LabQueueNode class with the following properties: It should have 2 private instance variables: HelpTicket ticket to store the help ticket, and LabQueueNode nextNode to store a link to the next node It must have a public 2-parameter constructor that has a parameter of type HelpTicket called ticket followed by a parameter of type LabQueueNode called nextNode. It should set the ticket and nextNode instance variables accordingly, and if the ticket argument is null, it should throw a NullTicketException It must have a public constructor that has a parameter of type HelpTicket called ticket, and it should do the same thing as the 2-parameter constructor, except it should set the nextNode instance variable to null It must have a public getter method for each of the 2 instance variables: getTicket and getNextNode It must have a public setter for the nextNode instance variable: setNextNode. If the user tries to set a node as its own nextNode, this method must throw a SelfNextException class HelpTicket extends Exception { private static int count = 0; private final String student Name; private final String description; private final int ticketID; private int ticketCount = 0; public HelpTicket(String studentName, String description) throws InvalidStudentNameException, InvalidDescriptionException { if(studentName == null) { throw new InvalidStudentNameException("studentName cannot be null"); else if(studentName == "") { throw new InvalidStudentNameException("studentName cannot be empty"); else if(description == null) { throw new InvalidDescriptionException ("description cannot be null"); else if(description == "") { throw new InvalidDescriptionException("description cannot be empty"); this.studentName = student Name; this.description = description; this.ticketID = ++this.count; public String getStudentName() { return this.studentName; public String getDescription() { return this.description; public int getTicketID) { return this.ticketID; TASK: Now that we have written some custom exceptions to handle some issues we might face when the user creates a new node, we can start building the components of our Linked List. Write a LabQueueNode class with the following properties: It should have 2 private instance variables: HelpTicket ticket to store the help ticket, and LabQueueNode nextNode to store a link to the next node It must have a public 2-parameter constructor that has a parameter of type HelpTicket called ticket followed by a parameter of type LabQueueNode called nextNode. It should set the ticket and nextNode instance variables accordingly, and if the ticket argument is null, it should throw a NullTicketException It must have a public constructor that has a parameter of type HelpTicket called ticket, and it should do the same thing as the 2-parameter constructor, except it should set the nextNode instance variable to null It must have a public getter method for each of the 2 instance variables: getTicket and getNextNode It must have a public setter for the nextNode instance variable: setNextNode. If the user tries to set a node as its own nextNode, this method must throw a SelfNextException class HelpTicket extends Exception { private static int count = 0; private final String student Name; private final String description; private final int ticketID; private int ticketCount = 0; public HelpTicket(String studentName, String description) throws InvalidStudentNameException, InvalidDescriptionException { if(studentName == null) { throw new InvalidStudentNameException("studentName cannot be null"); else if(studentName == "") { throw new InvalidStudentNameException("studentName cannot be empty"); else if(description == null) { throw new InvalidDescriptionException ("description cannot be null"); else if(description == "") { throw new InvalidDescriptionException("description cannot be empty"); this.studentName = student Name; this.description = description; this.ticketID = ++this.count; public String getStudentName() { return this.studentName; public String getDescription() { return this.description; public int getTicketID) { return this.ticketID

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_2

Step: 3

blur-text-image_3

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

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

More Books

Students also viewed these Databases questions