Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please do in JAVA In the previous challenge, you wrote two custom exceptions: InvalidStudentNameException and InvalidDescriptionException. In this challenge, we have included our own correct

please do in JAVA
image text in transcribed
In the previous challenge, you wrote two custom exceptions: InvalidStudentNameException and InvalidDescriptionException. In this challenge, we have included our own correct implementations of both exceptions (the code is just hidden from you) TASK: Now that we have written some custom exceptions to handle some issues we might face when the user creates a ticket, we can actually design a class to represent the tickets themselves. Each ticket should be able to store a student name, a description, and a unique identifier. Write a HelpTicket class with the following properties: It should have 1 private static variable: int count, which stores the number of tickets that have ever been created. If no tickets have ever been created, it will be 0; after the first ticket has been created, it will be 1; etc. It should have 3 private final instance variables: String student Name to store the student's name, String description to store the description, and int ticket ID to store this ticket's ID It must have a public 2-parameter constructor that has a parameter of type String called studentName followed by a parameter of type String called description. It should do the following: If the studentName argument is null, it should throw an InvalidStudentNameException with the following message: "studentName cannot be null" (no quotes) If the studentName argument is the empty string (i.e., "), it should throw an InvalidStudentNameException with the following message: "studentName cannot be empty' (no quotes) If the description argument is null, it should throw an InvalidDescriptionException with the following message: "description cannot be null" (no quotes) If the description argument is the empty string (i.e.,), it should throw an InvalidDescriptionException with the following message: "description cannot be empty" (no quotes) It should set the studentName and description instance variables accordingly It should set the ticketID instance variable to be how many tickets have ever been created after the creation of this one. For example, the first ever HelpTicket object should have a ticket ID of 1, the second ever HelpTicket object should have a ticketID of 2, etc. It should also update the static count variable of the HelpTicket class

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 Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions