程序代写代做代考 Java junit PolyU D-COMP Dr. Max Yu Pei

PolyU D-COMP Dr. Max Yu Pei
Goals:
Handout: Due:
COMP2021 Object Oriented Programming – Assignment Fall 2020
Assignment 4
Tuesday, 10 November 2020
11:59 am, Thursday, 26 November 2020
 To understand better the importance of information hiding, inheritance, polymorphism, and dynamic binding;
 To exercise writing generic classes;
 To practice using monitor operations to coordinate the access to shared objects; and
 To get more familiar with the IntelliJ Idea IDE;
Note:
 In this assignment, we are specifying the timeout for the test in BankAccountTest.java
using JUnit 5.7.0.
1. CalculatorLibrary(25points)
The calculator library contains classes that are like what you have seen in recent labs. In this task, we will extend the code to also support variables in expressions. Tests in
demonstrate how variables are used with expressions, where an object keeps track of the values of variables and can be used for evaluating expressions with variables.
What to Do:
[Task 1] Read the existing code and then provide the missing code in package calculator so that the classes will pass all the tests in CalculatorTest.java and satisfy their requirements as specified in the comments.
2. GenericSet(25points)
Class CompSet implements a HashSet as described on page 7 of Lecture07.pdf. What to Do:
[Task 2] Read and complete the class so that all requirements expressed in both CompSetTest.java and the code comments are satisfied. Note that you are not allowed to add new fields to class CompSet.
3. BankAccount Using Monitor Operations (20 points)
In this task, you will need to use synchronized methods/statements and operations like wait, notify, and notifyAll to coordinate the withdraw and deposite operations on a shared bank account.
What to Do:
[Task 3] Complete class BankAccount so that the test in BankAccountTest.java always executes successfully.
What to Hand in
A ZIP file containing all the files in Assignment-4.
CalculatorTest
Environment
1