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 / 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 |
What is lazy loading in jpa?
Is java a framework?
What is jndi datasource in java?
How do I run a java project in netbeans?
Can a method be static and synchronized?
What's a code group? : java security
Which method is used to create the daemon thread?
cant we call run() method directly instead of calling indirectly through the start() method ? if we do so then what is the problem ?
What is rxjava2?
What is Serialization?
Is java secure? : java security
Why do we need framework in java?