Help writing the SuccessInLife Class In Java,  I will figure out driver class later Class Fields/Variables: your class should have the following fields:  A static class variable/field that keeps track of how many event objects have been created (0 by default).  The following instance variables/fields:  A 7 digit alpha numeric unique bar code for each event  The location of the event, which starts with the name of the building followed by the room number   Event name   Event type, which can be one of the following  Quantity, which represents how many seats are requested  The event capacity (max number of spots allowed for this event) The number of seats already taken You should select the appropriate data type for each variable above. Make all instance variables private and make the static class variable public. Constructors: in addition to the default constructor, the class should have the following overloaded constructors:  a constructor that receives the event name and event type as parameters, and initializes the corresponding instance variables with those parameters. By default, it should set the number of seats already taken to zero. Then, it should call the following methods in order: o calcMaximumSeats method by passing the event type as a parameter. o generateBarCode method Another constructor that receives the event name, event type, and event capacity as parameters. This constructor does exactly what the previous constructor does, except that it overrides the default capacity calculated by the calcMaximumSeats method. For example, if the calcMaximumSeats method decides that the seminar in Fitch Hall holds up to 100 spots, the event planner might need to reduce that capacity to 50 (due to budget constraints for example). You should use constructor chaining instead of repeating code. Methods: The class should have the following private methods  A private method calcMaximumSeats that takes the event type as a parameter and initializes the location and capacity variables based on the event type as follows: For the job fair event type, you may set the capacity to a very large number (e.g., 100000000)  A private generateBarCode method that does not take any arguments and generates a bar code according to the following algorithm  Generates a 5-digit random number  Concatenates the first character of the event name, the first letter of the event location, and the 5 digit number. For example, if name is Success in Life and location is Library Hall 28, the generated code would be SLH89443. The method does not return any value. It just assigns the generated code to the bar code instance variable. The ScienceFair class should have the following public methods. Event type Location (Room) Capacity (Maximum Seats) Workshop Library Hall 28                                     30   Seminar Fitch Hall 151                                     100 Career fair Exhibit Hall Lobby                  Unlimited • Getters and setters for all instance variables, event name, location, and number of remining seats available. The method should take care of formatting the output as shown in the sample output below. The method should be smart enough to display seat , seats, or FULL depending on the return value of the getAvailableSeats method SLH23354         Success in Life           Library  Hall 28                FULL LFH56742         Life Seminar           Fitch Hall 151                      20 seats SLH23355           Succeful Communication       Library  28          1 seat JEH49492         Job Fair.           Exhibit Hall Lobby                    Unlimited  A getAvailableSeats method that returns the difference between the capacity (maximum number of spots) and the number of seats already taken. Two overloaded register methods:  that handles group registration by taking the quantity as a parameter.  If the event type is career fair, the method should not check the remaining seats. The method should increase the number of seats already taken by quantity and return true. If not, the method should return false and leave the number of seats already taken unchanged.  For other event types, it should check the number remaining seats. If remaining seats is > 0, the method should increase the number of seats already taken by quantity and return true. If not, the method should return false and leave the number of seats already taken unchanged.  One that handles individual registration. This method should not take any parameters, and should assume that the requested quantity is 1 by default.  If the event type is career fair, the method should not check the remaining seats. The method should increase the number of seats already taken by 1 and return true. If not, the method should return false and leave the number of seats already taken unchanged  For other event types, it should check the number remaining seats.  If remaining seats is > 0, the method should increase the number of seats already taken by 1 and return true. If not, the method should return false and leave the number of seats already taken unchanged.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter4: More Object Concepts
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question

Help writing the SuccessInLife Class In Java,  I will figure out driver class later

Class Fields/Variables: your class should have the following fields:
 A static class variable/field that keeps track of how many event objects have been
created (0 by default).
 The following instance variables/fields:
 A 7 digit alpha numeric unique bar code for each event
 The location of the event, which starts with the name of the building followed
by the room number 
 Event name 
 Event type, which can be one of the following
 Quantity, which represents how many seats are requested
 The event capacity (max number of spots allowed for this event)
The number of seats already taken
You should select the appropriate data type for each variable above. Make all instance
variables private and make the static class variable public.

Constructors: in addition to the default constructor, the class should have the following
overloaded constructors:
 a constructor that receives the event name and event type as parameters, and initializes
the corresponding instance variables with those parameters. By default, it should set
the number of seats already taken to zero. Then, it should call the following methods in
order:
o calcMaximumSeats method by passing the event type as a parameter.
o generateBarCode method
Another constructor that receives the event name, event type, and event capacity as
parameters. This constructor does exactly what the previous constructor does, except
that it overrides the default capacity calculated by the calcMaximumSeats method.
For example, if the calcMaximumSeats method decides that the seminar in Fitch Hall holds up to 100 spots, the event planner might need to reduce that
capacity to 50 (due to budget constraints for example). You should use constructor
chaining instead of repeating code.
Methods:
The class should have the following private methods
 A private method calcMaximumSeats that takes the event type as a parameter and
initializes the location and capacity variables based on the event type as follows:

For the job fair event type, you may set the capacity to a very large number (e.g.,
100000000)
 A private generateBarCode method that does not take any arguments and generates a
bar code according to the following algorithm
 Generates a 5-digit random number
 Concatenates the first character of the event name, the first letter of the event
location, and the 5 digit number. For example, if name is Success in Life and
location is Library Hall 28, the generated code would be SLH89443.
The method does not return any value. It just assigns the generated code to the bar
code instance variable.
The ScienceFair class should have the following public methods.
Event type Location (Room) Capacity (Maximum

Seats)
Workshop Library Hall 28                                     30  
Seminar Fitch Hall 151                                     100
Career fair Exhibit Hall Lobby                  Unlimited

• Getters and setters for all instance variables, event name, location, and
number of remining seats available. The method should take care of formatting the output
as shown in the sample output below. The method should be smart enough to display seat
, seats, or FULL depending on the return value of the
getAvailableSeats method
SLH23354         Success in Life           Library  Hall 28                FULL
LFH56742         Life Seminar           Fitch Hall 151                      20 seats
SLH23355           Succeful Communication       Library  28          1 seat
JEH49492         Job Fair.           Exhibit Hall Lobby                    Unlimited
 A getAvailableSeats method that returns the difference between the capacity
(maximum number of spots) and the number of seats already taken.
Two overloaded register methods:
 that handles group registration by taking the quantity as a parameter.
 If the event type is career fair, the method should not check the remaining
seats. The method should increase the number of seats already taken by
quantity and return true. If not, the method should return false and leave
the number of seats already taken unchanged.
 For other event types, it should check the number remaining seats. If
remaining seats is > 0, the method should increase the number of seats
already taken by quantity and return true. If not, the method should return
false and leave the number of seats already taken unchanged.
 One that handles individual registration. This method should not take any
parameters, and should assume that the requested quantity is 1 by default.
 If the event type is career fair, the method should not check the remaining
seats. The method should increase the number of seats already taken by 1
and return true. If not, the method should return false and leave the number
of seats already taken unchanged
 For other event types, it should check the number remaining seats.
 If remaining seats is > 0, the method should increase the number of
seats already taken by 1 and return true. If not, the method should
return false and leave the number of seats already taken unchanged.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT