The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Hi I need help with my assignment.
Can anyone solve this please?
Â
CS520 Week 6 AssignmentGeneral Rules for Homework Assignments•You are strongly encouraged to add comments throughout the program. Doingso will help your facilitator to understand your programming logic and gradeyou more accurately.•You must work on your assignments individually. You arenot allowedto copythe answers from the others.However, you are encouraged to discuss theapproaches to the homework assignments with your section mates and thefacilitator in your section via the discussion board.•Each assignment has a strict deadline. However, you are still allowed to submityour assignment within 2 days after the deadline with a penalty. 15% of thecredit will be deducted unless you made previous arrangements with yourfacilitator and professor. Assignments submitted 2 days after the deadline willnot be graded.•When the termlastNameis referenced in an assignment, please replace it withyour last name.You are strongly encouraged to add comments into your program!Create a new Java Project in Eclipse named HW6_lastNameand complete thefollowing requirements based on the Threads. Several threads will share a singleobject and contribute their individual result to the shared object. The shared objectaccumulates the partial results.Createa package namedcs520.hw6.Using this package, create the followingclasses.1. Create a class namedSharedResultsas follows. The class keeps track of thesharedresult.a. The instance (or member) private variable –result(int).b. A voidaddToResultmethod which takes the given integer argument andadds it to the sharedresult. This method then prints to the console thename of the current thread, the value it added, and the cumulativeresult. Handle the synchronization issue with this method.c. ThegetResultmethod with no arguments which returns the sharedresult. Handle the synchronization issue with this method.2. Create a class namedLongTaskwhich extends theThreadclass.a.The instance (or member) private variables –sharedData(oftypeSharedResults),start(integer) andend(integer).b.A single constructor which takes the above three arguments andstores them in the instance values. Also, create a name for thisthread asThread_<start>_<end>
Attachments: