Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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.



there are 67 seats in train . there are only 5 seats in a row and in last row there are only 2 sea..

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

Post New Answer

More Java Related AllOther Interview Questions

What is lazy loading in jpa?

1 Answers  


Is java a framework?

1 Answers  


What is jndi datasource in java?

1 Answers  


How do I run a java project in netbeans?

1 Answers  


Can a method be static and synchronized?

1 Answers  


What's a code group? : java security

1 Answers  


Which method is used to create the daemon thread?

1 Answers  


cant we call run() method directly instead of calling indirectly through the start() method ? if we do so then what is the problem ?

7 Answers   HSBC, Subex,


What is rxjava2?

1 Answers  


What is Serialization?

2 Answers   HCL,


Is java secure? : java security

1 Answers  


Why do we need framework in java?

1 Answers  


Categories