NB: all the questions on this assessment are based on both learning unit 9: Threads and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
NB: all the questions on this assessment are based on both learning unit 9: Threads and learning unit 10: Concurrency Application Question(s) 25 Marks Question 1 Create a Java program that simulates a basic counter. The counter should be incremented by multiple threads. Two (2) threads per implementation. Implementations: 1. Use synchronized keyword to increment the counter and to display the value of the counter. 2 Use Atomic Integer from java.util.concurrent.atomic package to increment the counter and display its value Ensure that the value of the counter is correctly displayed when incremented by multiple threads in both implementations Expected Output: The output can vary because of thread interleaving, but the final count value must be consistent. For example, if you have two threads and each one increments the counter 1000 times, the final counter value should be 2000. Design an interface that will prompt the user to insert a value that will be incremented using both threads Below is an example of the interface where each thread increments the counter 5 times. ENTER VALUE COUNT RESULT 10 NB: your interface must prompt the user for both implementations. PRG522-Formative Assessment 3 Semester 2 Paper 2023 (V10 INPUT BUTTON OUTPUT Page 3 of 5 Scenario Question(s) Question 2 Study the scenario and complete the question(s) that follow CTU Sports Day Timer App Faced with the challenge of implementing a high-performance stop-watch feature in an athletic performance tracking application, Sarah, a seasoned Java developer, dives into her IDE with focus and determination. The requirements specify that the stop-watch must be accurate down to the second and must allow users to start, and stop the time via a user-friendly interface. After carefully weighing her options, she decides to utilize Java's System.current TimeMillis() method for precise time tracking, as well as threading to ensure that the stop-watch runs independently of the application's main execution flow. Armed with her plan, she crafts a robust class encapsulating the stop-watch logic. complete with methods for start, and stop. With a solid test suite validating the accuracy and performance of her implementation, Sarah confidently merges her code into the main branch, enhancing the application's functionality and meeting the needs of athletes striving for peak performance. Source: Mashile T. (2023) Create a Java application for CTU Sports Day called "CTU Timer". The application must consist of a graphic user interface similar to the one displayed below: CTU TIMER TIME in seconds) START TIMER STOP TIMER uneditable text field buttons 25 Marks It must consist of two (2) buttons, labels and an uneditable text field to display the counts. The application must make use of a thread to do the counting. The counter should move at intervals of one (1) second. When the Start timer button is clicked, the timer should start counting. When the Stop timer button is clicked, the timer should stop When the "Start timer button is clicked again, the timer must continue counting where it left off Instructions to submit: Create a folder in which you will compress and submit your work This folder should contain two (2) documents NB: If you develop a basic Java Swing app that simply implements a timer but does not use threads you will get extensive mark deductions. Ensure that your application handles basic exceptions 1 A text file which contains the source code 2 A PDF file which shows screenshots of your source code and interface in a sequential manner of execution of your applications both in Question 1 and Question 2 End of Formative Assessment 2 Grand Total: 50 Marking Rubric Description Question 1 Made use of a synchronized object Made use of an atomic integer object Created two Synchronized threads Created two Atomic Integer threads Designed appropriate user interfaces Question 2 Start/Stop button works The timer counter stops and continues from where it stopped Made use of appropriate methods: Start), Stopo, Try Catch Good programming practices: Comments, Classes, Objects, Indentation, Line spacing, and Inheritance Made use of a thread for the counter Designed an appropriate user interface Good PRG522 - Formative Assessment 3 Semester 2 Paper 2023 | V10 Marking Criteria Farly good Question 1 Total Question 2 Total Final mark /25 /25 /50 Page 5 of 5 NB: all the questions on this assessment are based on both learning unit 9: Threads and learning unit 10: Concurrency Application Question(s) 25 Marks Question 1 Create a Java program that simulates a basic counter. The counter should be incremented by multiple threads. Two (2) threads per implementation. Implementations: 1. Use synchronized keyword to increment the counter and to display the value of the counter. 2 Use Atomic Integer from java.util.concurrent.atomic package to increment the counter and display its value Ensure that the value of the counter is correctly displayed when incremented by multiple threads in both implementations Expected Output: The output can vary because of thread interleaving, but the final count value must be consistent. For example, if you have two threads and each one increments the counter 1000 times, the final counter value should be 2000. Design an interface that will prompt the user to insert a value that will be incremented using both threads Below is an example of the interface where each thread increments the counter 5 times. ENTER VALUE COUNT RESULT 10 NB: your interface must prompt the user for both implementations. PRG522-Formative Assessment 3 Semester 2 Paper 2023 (V10 INPUT BUTTON OUTPUT Page 3 of 5 Scenario Question(s) Question 2 Study the scenario and complete the question(s) that follow CTU Sports Day Timer App Faced with the challenge of implementing a high-performance stop-watch feature in an athletic performance tracking application, Sarah, a seasoned Java developer, dives into her IDE with focus and determination. The requirements specify that the stop-watch must be accurate down to the second and must allow users to start, and stop the time via a user-friendly interface. After carefully weighing her options, she decides to utilize Java's System.current TimeMillis() method for precise time tracking, as well as threading to ensure that the stop-watch runs independently of the application's main execution flow. Armed with her plan, she crafts a robust class encapsulating the stop-watch logic. complete with methods for start, and stop. With a solid test suite validating the accuracy and performance of her implementation, Sarah confidently merges her code into the main branch, enhancing the application's functionality and meeting the needs of athletes striving for peak performance. Source: Mashile T. (2023) Create a Java application for CTU Sports Day called "CTU Timer". The application must consist of a graphic user interface similar to the one displayed below: CTU TIMER TIME in seconds) START TIMER STOP TIMER uneditable text field buttons 25 Marks It must consist of two (2) buttons, labels and an uneditable text field to display the counts. The application must make use of a thread to do the counting. The counter should move at intervals of one (1) second. When the Start timer button is clicked, the timer should start counting. When the Stop timer button is clicked, the timer should stop When the "Start timer button is clicked again, the timer must continue counting where it left off Instructions to submit: Create a folder in which you will compress and submit your work This folder should contain two (2) documents NB: If you develop a basic Java Swing app that simply implements a timer but does not use threads you will get extensive mark deductions. Ensure that your application handles basic exceptions 1 A text file which contains the source code 2 A PDF file which shows screenshots of your source code and interface in a sequential manner of execution of your applications both in Question 1 and Question 2 End of Formative Assessment 2 Grand Total: 50 Marking Rubric Description Question 1 Made use of a synchronized object Made use of an atomic integer object Created two Synchronized threads Created two Atomic Integer threads Designed appropriate user interfaces Question 2 Start/Stop button works The timer counter stops and continues from where it stopped Made use of appropriate methods: Start), Stopo, Try Catch Good programming practices: Comments, Classes, Objects, Indentation, Line spacing, and Inheritance Made use of a thread for the counter Designed an appropriate user interface Good PRG522 - Formative Assessment 3 Semester 2 Paper 2023 | V10 Marking Criteria Farly good Question 1 Total Question 2 Total Final mark /25 /25 /50 Page 5 of 5
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Draw the Relational Schema Model for the ER Diagram below: lastName firstName) (street city custId state zip custName custAdd credit Limit Phone areaCode number supplierNo supName Phone Customer M...
-
It is the post-apocalyptic era, and hardship and depression run rampant. You are currently at the bottom of a staircase in the basement of an abandoned building looking at what is pure...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Which one of the following statements related to investigations of workplace harassment complaints under Ontario's OHSA is true? a) As a rule, such investigations should be completed with 120 days of...
-
The hydraulic crane is used to lift the load of weight W. Determine the force in the hydraulic cylinder AB and the force in links AC and AD when the load is held in the position shown. Units Used:...
-
What amount of gain should Pharoah recognize on the exchange assuming lack of commercial substance?
-
Consider the National Football League data in Table B.1. Restricting your attention to regressors \(x_{1}\) (rushing yards), \(x_{2}\) (passing yards), \(x_{4}\) (field goal percentage), \(x_{7}\)...
-
Hi-sense Technologies produces stripped-down phones for sale to customers in frontier economies. The firm purchases used or obsolete models of specific smartphone models. It removes nonstandard...
-
Name Gross Earnings Taxable Wages for Federal W/H Taxable Wages for FICA Federal W/H Social Security Tax Medicare Tax State W/H Garnishment United Way Net Pay Check Number\ Rosenberg, A. $688.00...
-
All sales of Tracys Jeans and Uniforms (TJU) are made on credit. Sales are billed twice monthly, on the fifth of the month for the last half of the prior months sales and on the twentieth of the...
-
You turned 25 today and you want to retire on your 60th birthday. Starting with the day of your retirement, you would like to have a growing annuity ($50,000 payment on the day of your retirement and...
-
Quartiles Violent crimes include rape, robbery, assault, and homicide. The following is a summary of the violent-crime rate (violent crimes per 100,000 population) for all states of a country in a...
-
In a certain city, the average 20 to 29 year old man is 69.8 inches tall, with a standard deviation of 3.0 inches, while the average 20 to 29 year old woman is 64.3 inches tall, with a standard...
-
The following data represent the flight time (in minutes) of a random sample of seven flights from one city to another city. 284, 270, 260, 266, 257, 263, 269 Compute the range and sample standard...
-
Sample: 4, 46, 14, 51, 32, 23, 28, 30, 36, 27 By hand, find the population variance and standard deviation or the sample variance and standard deviation as indicated.
-
The median for the given set of six ordered data values is 30.5. What is the missing value? 5 12 25 41 58
-
A company's marginal cost function is MC=21x^4/3-6x^1/2+50,where x is the number of units, and fixed costs are $3000. Find thecost function.
-
Feller Company purchased a site for a limestone quarry for $100,000 on January 2, 2019. It estimate that the quarry will yield 400,000 tons of limestone. It estimates that its retirement obligation...
-
Sally and Charles Heck received the following dividends and interest during 2012: Assuming the Hecks file a joint tax return, complete Schedule B of Form 1040 (on page 2-33) for them for the 2012 tax...
-
Larry Gaines, age 42, sells his personal residence on November 12, 2012, for $144,000. He lived in the house for 7 years. The expenses of the sale are $10,500, and he has made capital improvements of...
-
Frederick (Freddy) Freeweights (age 42) owns and operates a health club called ''Treadmills West.'' The business is located at 4321 Arnold Street, Alpine, CA 91901. Freddy had the following income...
-
That financial ratios are most valuable when viewed in comparison to the organizations historical ratio values and competitors values. Why is this context valuable when examining financial ratio...
-
What are the five forms of financing, and how is each used within sport?
-
For many years, womens professional basketball struggled for consistency in the United States. Since 1978, when the Womens Professional Basketball League (WBL) was formed, leagues have had difficulty...
Study smarter with the SolutionInn App