{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

(CIS110 -Cmptr Prgrmmng Dsgn) Week 9 Assignment

(CIS110 -Cmptr Prgrmmng Dsgn) Week 9 Assignment - Declare...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Class Pet // Fields Private String name Private String type Private String age // Contructor Public module Pet (string petsName, String petsType, Integer petsAge) Set name = petsName Set type = petsType Set age = petsAge End Module // Mutators Public Module setName (String petsName) Set name = petsName End Module Public Module setType (String petsType) Set type = petsType
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
End Module Public Module setAge (Integer petsAge) Set age = petsAge End Module // Accessors Public Function String getName () Return name End Function Public Function String getType () Return type End Function Public Function Integer getAge () Return age End Function End Class ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Module main ()
Background image of page 2
// Variables for data entered from user Declare String name, type
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Declare Integer age Declare Pet petInformation // Get the user’s pet information Display “Enter your pets name.” Input name Display “Enter the type of pet that you have.” Input type Display “Enter your pets age.” Input age // Create a Pet object with the data entered from the user Set petInformation = new Pet (name, type, age) // Display values in the fields. Display “Your pets name is “, petInformation.getName() Display “Your type of pet is called a “, petInformation.getType() Display “The age of your pet is “, petInformation.getAge(), “years” End Module Review Questions p. 519-521 1. B 2. D 3. C 4. C 5. A 6. C 7. B 8. D 9. C 10. B 11. A 12. B 13. D 14. B 15. C 16. A...
View Full Document

{[ snackBarMessage ]}