Disease class given 3 Diseases 10 marks Create two classes 2

Disease class given.
3: Diseases [10 marks Create two classes: 2ika and Plague. Each of these classes must extend the Disease class. Each of these classes must define (override) both abstract methods inherited from Dise For each when creating objects, the name passed in should just be the name of the disease. COMP1006/1406-Fall 2016 Assignment #5 Due Tuesday, November 1 at 3:30 . Zika class: The severity should be an integer between 0 and 10 (inclusive) public void ispact (Person p) // Precondition: one /I Postconditions: none /I Side Effects: /1 (1) the persoa\'s health vill be decreased by the value of the severity of the disease 1I (2) The disease\'a severity vill be reduced by (untl it reaches zero) // (3) The disease\'s chance of transa1881on 18 reduced by 10% (1.e. 0.9current chance of transnission) public void treat O // Pre and postconditions: none // Side Effects: Both the severity and chance of transmiasion 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 integbetween 0 and 100 (inclusive) public void ispact (Person p) // Pre and postconditions: none /I Side Effects II (1) the person\'s health vill be decreased by 5 if the severity if larger than S0 and decreased by 2 if the aeverity is /less than or equal to 50 public void treat ) // Pre and postconditions: none // Side Effects: Severity ia reduced by a factor of 3 (i.e. it is replaced by 1/3 of the current value, uaing integer division) Chance of transmission remaina the aame

Solution

Please find the required classes along with the comments which describes the step :

Disease class given. 3: Diseases [10 marks Create two classes: 2ika and Plague. Each of these classes must extend the Disease class. Each of these classes must

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site