Each of these classes extend the disease class each of


Diseases

Create two class: Zika and Plage. Each of these classes extend the Disease class. Each of these class must define (override) both abstract methods inherited from disease.

Foe each, when creating objects, the name password in should just be the name of the disease.
Zika class: The security should be an integer between 0 and 10 (inclusive).
public void impact(Person p)
// Precondition: none
// Postconditions: none
// Side Effects:
// (1) the person's health will be decreased by the value of the severity of the disease
// (2) The disease's severity will be reduced by 1 (until it reaches zero)
// (3) The disease's chance of transmission is reduced by 10% (i.e. 0.9 - current chance of transmission)
public void treat()
// Pre and postcoaditions: none
// Side Effects: Both the severity and chance of transmission are reduced by a factor of 2. (i.e. each is //replaced by 1/2 of the current value, using Integer division for severity)
- Plague class: The severity should be an integer between 0 and 100 (inclusive).
public void impact(Person p)
// Pre and postconditions: none
// Side Effects:
// (1) the person's health will be decreased by 5 if the severity if larger than SO and decreased by 2 if the severity is less than or equal to SO
public void treat()
// Pre and postconditionsl none
// Side Effects: Severity is reduced by a factor of 3 (1.e. it is replaced by 1/3
// of the current value, using integer division)
// Chance of transmission remains the same.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Each of these classes extend the disease class each of
Reference No:- TGS02372595

Now Priced at $20 (50% Discount)

Recommended (93%)

Rated (4.5/5)