Answer:
No Answer by by a third jsjshs
Answer:
int counter = 0;
String userInput = "";
while (userInput != "stop") {
print "What pet do you have? ";
userInput = readInputLine();
if (userInput != "stop" ){
counter = counter + 1;
print "\nYou have one ";
print userInput;
print ". Total # of Pets: ";
print counter;
}
}
Explanation:
not sure what programming language you use, therefore the answer is pseudocode but it should give you an idea how to implement a piece of code for this problem.
Also, from the way you described the exercise I'm not sure if you always are supposed to reply with "you have one" + the pet or if you should count how often the same pet was entered.
I do it immediately, so it don’t effect my assignments or grades.
Give the type and value of each result of the following Java expressions. a. (5 / 2) * 2.0 type is float value is 4.0 b. (5/2.0) * 2 type is integer value is 5c. "1.3" + "5.2" type is string value is 1.35.2d. 1 + 7.0 + "2" + "x" this will produce an error because we cannot add variables of different type