Question: Write a program to implement the pseudocode given below for the procedural Fish example: Sub feed (Byref state, Byref size) sizesize + 1 Output
Write a program to implement the pseudocode given below for the procedural Fish example: Sub feed (Byref state, Byref size) sizesize + 1 Output "Fish fed" If size = 5 Then "FISH" state End If End Sub thisFishState thisFishSize 1 Output this FishState, is of size While thisFishState "FISH" feed (this FishState, this FishSize) Endwhile "1 Output "It is now a big , this FishState Public Task 2 Write program statements to declare the class Animal, as shown in the pseudocode: Animal Classi Private Constructor (s, n) Procedure feed () Function getState () Function getSize () state: String size: Integer "Fish" Animal. Constructor (s, n) s Animal.state Animal. size End Constructor Animal.size Procedure Animal.feed () End If End Procedure n If Animal.size = 5 Then Animal.state "FISH" End Function. Animal.size + 1 Function Animal.getState () Return Animal.state End Function Function Animal.getSize() Return Animal.size I thisFishSize ("I SC 51 t ti ti ti
Step by Step Solution
3.45 Rating (152 Votes )
There are 3 Steps involved in it
Ta... View full answer
Get step-by-step solutions from verified subject matter experts
