ADVICE:
Start from scratch.
Canibalize carefully!
CS16 Exam #2
Write a class named "XYZ2e" that includes the private data fields specified by the following table, and public methods described below.
identifier | type | // Description |
---|---|---|
id | int | // Employee ID number. |
gross | double | // Gross pay for this week. |
married | boolean | // True iff married. |
dep | int | // Number of additional dependents. |
vac | int | // Number of annual vacation days allotted. |
used | double | // Vacation days (or fraction thereof) used, so far this year. |
method | (args) | // Description |
---|---|---|
vacleft | () | // Return the amount of vacation remaining. |
exemptions | () | // Return the exemption amount, as follows:
|
(get/set) | ( . . . ) | // Provide get/set methods ONLY as needed for this exam! |
XYZ2e | ( int, bool, int, double) | // Also include a four-argument constructor, that accepts an integer id, a boolean value for "married", an integer number of additional dependents, and a gross pay amount (for testing purposes). |
Now, write another ("driver") class whose "main( ... ) method performs the following tasks, to test your "XYZ2e" class:
ID: | 111 | 222 | 333 | 444 | 555 |
---|---|---|---|---|---|
days used: | 11 | 2 | 3 | 4 | 5 |