The book I'm using keeps referring back and forth to figures and doesn't provide good examples similar to what I'm trying to do. So this is what I came up with.
Here go my questions and concerns. I'm not sure if I placed the class Pet in the correct spot, I think I did though. The other two are related to where I ask the user for their input and output, is that the correct placement?
This is PSEUDO CODE by the way.
class PetClassProgram main() //Declarations private string petName private string petType private num petAge Pet (string name, string type, num age) petName = name petType = type petAge = age public void setPetName(string name) petName = name return public void setPetType(string type) petType = type return public void setPetAge(num age) petAge = age return public string getPetName() string petName output “Please enter your pet’s name: ” input petName return petName public string getPetType() string petType output “Please enter what type of pet you have (i.e. Dog, Cat, Bird, Lizard, etc.): ” input petType return petType public num getPetAge() num petAge output “Please enter your pet’s age: ” input petAge return petAge output “Pet’s name : ” getPetName() output “Pet type : ” getPetType() output “Pet’s age : ” getPetAge() return endClass
Just reviewing the code right now, would I be correct to assume that I don't need string petType, string petName , num petAge declared as variables in my get methods if I already did it in the beginning? Something like this....
public string getPetName() output “Please enter your pet’s name: ” input petName return petName public string getPetType() output “Please enter what type of pet you have (i.e. Dog, Cat, Bird, Lizard, etc.): ” input petType return petType public num getPetAge() output “Please enter your pet’s age: ” input petAge return petAge
Thank you,
-=wolfman


Sign In
Create Account


Back to top









