Skip to main content

The Sky-blue and the gnomes project in Java | Java Assignment | Java Homework

Once upon a time, there was a princess named Sky-blue. The princess’s stepmother, the Queen was very mean and vain. She was jealous because she wanted to be known as "the fairest in the land," and Sky-blue’s beauty surpassed her own. One day, Sky-blue couldn’t take it anymore and run away to a fairy garden. In the garden, she found a small cabin. In the cabin, there were num_gnomes little beds, one table of table_size size, one love seat, one recliner and a big 50” flat screen TV. However, the cabin was very dirty and failed to provide a pleasant environment to relax and watch a good movie.
Sky-blue decided to start cleaning and cooking. Soon she got exhausted and fell asleep (use wait)

In the evening, the gnomes arrived home from the diamond mine. They computed in different ways (sleep of random time) but they always waited for each other, so that all of them should be at the door before entering the cabin. The last gnome to arrive opened the door ((use monitors and operations on monitors) allowing everyone to get in. Once they entered the cabin, they were mesmerized by how beautiful and clean their house looked. They could immediately see the TV-remote, which was a miracle. It didn’t take them too long to find Sky-blue. The gnomes then started to make a lot of noise trying to wake up the princess (notify). Next, they all waited for the princess to let them know how she got there and who she was.

Time for dinner came and the gnomes got very hungry. While Sky_Blue was setting up the table, the gnomes gathered in groups of table_size (use one different monitor for each group). Sky_Blue will signal the group’s members to have a seat and eat. Each member of the group will eat (sleep of random time) and the last gnome of the group (you might use a counter accessed in a mutual exclusion way) to leave the table will let (signal) Sky-Blue know. She then will allow the next group to eat (keep in mind that the last table might not be completely occupied).

Once the dinner ends, the gnomes want to watch a movie (use wait). All the gnomes should be done eating by the time Sky-blue announce the movie. After washing the dishes, Sky-Blue announces the first movie. The movie runs twice. There are only one recliner and a love seat, so only three gnomes can watch the movie at a given time. If a gnome couldn’t get a seat, he will wait for the second run of the movie, and then try to get a seat. Sky-blue is a great time keeper. After sleeping for a fixed amount of time, she will let the gnomes who watched the movie and the ones that are waiting for watching a movie know that the movie has ended (using notifyAll).

Once the recliner and sofa are occupied again, the next movie will start. Sky-Blue, since she is very tired, will sleep during this movie too and after a fixed amount of time she will wake up and announce the end of the second movie.
Once a gnome has watched a movie, or maybe didn’t have the chance to do so, he will go to bed (wait for Sky-Blue to wake him up in the morning).
Sky-Blue will sleep too (sleep of fixed amount of time) and when she wakes up she will wake all of them up again.

In the morning, the gnomes brush their teeth, take a shower and line up for Sky-Blue. In exchange for a diamond, she gives them a kiss and their lunch box (each gnome blocks on a different object and is kissed by Sky-Blue in an FCFS order, a similar implementation to the one in rwcv.java).

Once all the gnomes leave for work you can have all the threads exit.

Program Screenshot:



Program Video:




Buy now

CONTACT DETAILS

For any other questions or other tasks please feel free to contact me
via email: mhassnainjamil@gmail.com
via WhatsApp: +92-324-7042178
via skype: hassnainjamil1

Comments

Popular posts from this blog

The Zoo Management System - entity relationship diagram & MS Access Database

Zoo Management System - Project Details: You are the employee of a big, worldwide working Zoo Management Company. Your company is responsible for the Zoo management. Your boss thinks it would be a great idea to store all data for each Zoo in a brand new self-developed ZOO Management System. Up to now, the ZOO management company has maps of each ZOO available. Your boss knows that you took a course in introduction on an ERP system, so he asks you if you could help designing such a system. Each ZOO must have the same organizational structure, which should look like this: Each Zoo has a Zoo-Address. Each Zoo has many visitors (Visitor Ticket Process (VTP). Many Zoo-Attractions belong to a Zoo. Module 1: Entity Relationship Diagram Design a ER (entity-relationship) diagram for your ZOO Management System. Use the information provided below with the entities and its attributes. Put the entities in the correct relationship to each other (organizational structure). Module 2: DB Implem...

EIT Knowledge and Innovative Community Scholarships has been announced

Admission Criteria To qualify for our programmes, applicants need to fulfill the admission requirements based on previous studies, English proficiency and relevant documentation. Previous Studies: A Completed Bachelor’s Degree In order to be admitted into a KIC InnoEnergy MSc programme, you must have completed a Bachelor’s degree encompassing a minimum of 180 ECTS credits or equivalent academic qualifications from an internationally recognized university. Please note that admissions depend on the specific BSc degree you hold for entry into the MSc programme you are interested in. Conditional Acceptance – Undergraduate Students in Final Year Students in their final year of undergraduate education may also apply and if expected to qualify, receive a conditional offer. If you have not completed your studies, please include a written statement from your university’s administration office (or equivalent department), confirming that you are enrolled in the final year of your study programme ...

Human Physiology by Stuart Ira Fox [PDF] (12th edition) free download