Class Person
java.lang.Object
Person
Capture a person who can drink soda.
A person can sip or gulp from a can of soda.
The person knows how much soda they have consumed,
and know how thirsty they are.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionA person is "very thirsty" if they drank less than 175, "thirsty" if they drank less than 375, "satisfied" if they drank at least 375voidTake a gulp from s, modifying the amount this has consumedvoidTake a sip from s, modifying the amount this has consumedtoString()
-
Constructor Details
-
Person
Construct a new Person with the given name. So far they will have consumed 0 soda- Parameters:
name- the name given to this person
-
-
Method Details
-
sipFrom
Take a sip from s, modifying the amount this has consumed- Parameters:
s- the can of soda this will sip from
-
gulpFrom
Take a gulp from s, modifying the amount this has consumed- Parameters:
s- the can of soda this will gulp from
-
getThirstStatus
A person is "very thirsty" if they drank less than 175, "thirsty" if they drank less than 375, "satisfied" if they drank at least 375- Returns:
- the thirst status of this
-
toString
-