Question: Create a console application that can estimate whether the booking is a profit or loss, thereby enabling hall owners to reduce or increase expenses depending

Create a console application that can estimate whether the booking is a profit or loss, thereby enabling hall owners to reduce or increase expenses depending on the status. Hence if several Booking details are given, compute whether the bookings are profitable or not. Use Threads to compute for each booking, Finally display the details along with the profit/loss status.

Create a class Event with the following private attributes

Attributes Datatype
name String
hallbooking HallBooking

Include appropriate getters and setters. Create default constructor and a parameterized constructor with arguments in order Event(String name,HallBooking hallbooking).

Create a class HallBooking with following private attributes

Attributes Datatype
hallName String
cost Double
hallCapacity Integer
seatsBooked Integer

Include appropriate getters and setters. Create default constructor and a parameterized constructor with arguments in order HallBooking(String hallName, Double cost, Integer hallCapacity,Integer seatsBooked).

Create a class ComputeStatus that implements Runnable interface with List eventList attribute. Include following methods. Override run() method which displays event name along with their status (i.e) Profit or Loss. If (seats booked / hall capacity) * 100 >= 60 then it is a profit else loss . Create a driver class Main which creates ThreadGroup with two threads. Each thread will have half of the event details. After the first half of event details are obtained, invoke the first thread and after the other half is obtained invoke the second thread. The Threads print the status of the events. Use the join method appropriately to ensure printing the status in the correct order.

Input Format: The first line of input corresponds to the number of events 'n'. The next 'n' line of input corresponds to the event details in CSV format of (Event Name,Hall Name,Cost,Hall Capacity,Seats Booked). Refer to sample input for formatting specifications. Output Format: The output consists of event names with their status (Profit or Loss). Refer to sample output for formatting specifications. Problem Constraints: If n>0 and n then even. Otherwise, display as "Invalid Input". Sample Input and Output 1: [All text in bold corresponds to input and rest corresponds to output] Enter the number of events 4 Enter event details in CSV Party,Le Meridian,12000,400,250 Wedding,MS mahal,500000,1000,400 Alumni meet,Ramans,10000,600,300 Plaza party,Rizzodous,30000,1200,1000 Party yields profit Wedding yields loss Alumni meet yields loss Plaza party yields profit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!