there are 67 seats in train . there are only 5 seats in a
row and in last row there are only 2 seats. One person can
reseve only 5 seat at a time. If person reserving seat ,
the care is atken that he may get all in row. if seats are
not available in row then the arrangement is so that person
group get nearby seats. the following class is given public
class seat { char name; int seat; boolean isSeatempty }
1.Draw require class digram and object diagram. 2.Write
function seatallot(int noofperson) to allocate seat with
seat nuber printed for the each name.
Answer Posted / Mohan Singh
[
{"name": "Class Diagram", "description": "UML Class Diagram showing the relationships between Seat and Person classes, where Seat has a many-to-one relationship with Person, and contains attributes: name (character), seat (integer) and isSeatEmpty (boolean)."},
{"name": "Object Diagram", "description": "Object diagram representing an example state of the system. It may contain instances of the Seat class, each assigned to a specific person with a given seat number, and marked as either empty or occupied."},
{"name": "Function seatallot(int noofperson)", "description": "Java method that accepts the number of persons as input and returns void. It checks the availability of seats in rows from left to right, starting with the first row. If a group of 5 seats is available, it allocates them to the next 5 people in the list. If not, it finds the nearest available 5-seat block or 2-seat block and allocates those seats accordingly. The function prints the seat number for each person along with their name as part of the allocation process.".}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the locale class?
What do you understand by casting in java language? What are the types of casting?
What if I write static public void instead of public static void?
How does java handle integer overflows and underflows?
What is the resourcebundle class?
what is reflection api? How are they implemented?
What is the java api?
What is the first argument of the string array in main method?
Are jvm’s platform independent?
Can we extract main method from another class?