1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
DaniilM [7]
1 year ago
13

Write a loop that continually asks the user what pets the user has until the user enters stop, in which case the loop ends. It s

hould acknowledge the user in the following format. For the first pet, it should say You have one cat. Total # of Pets: 1 if they enter cat, and so on.
Sample Run
What pet do you have? lemur
What pet do you have? parrot
What pet do you have? cat
What pet do you have? stop
Sample Output
What pet do you have? lemur
You have one lemur. Total # of Pets: 1
What pet do you have? parrot
You have one parrot. Total # of Pets: 2
What pet do you have? cat
You have one cat. Total # of Pets: 3
What pet do you have? stop
Computers and Technology
1 answer:
Nataliya [291]1 year ago
6 0

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.

You might be interested in
Which program will have the output shown below?
kumpel [21]

for count in range(5, 8):

   print(count)

This will produce.

5

6

7

I hope this helps!

5 0
3 years ago
Which of the following are the functions of an os?
cricket20 [7]
Manage the computer's resources, such as the central processing unit, memory, disk drives, and printers, (2) establish a user interface, and (3) execute and provide services for applications software.
6 0
3 years ago
If a database was being used to track sales, a customer who buys a lot of items would be a good example of how two tables could
3241004551 [841]

Answer:True

Explanation:

7 0
3 years ago
What software is my teacher using to do this and how can i stop her from doing this
aliina [53]

Answer:

I’m not sure if you can only teachers can acess that

Explanation:

7 0
3 years ago
Read 2 more answers
Whats 9+9+9+9x999-86 divided by 874 times 8764
Alexxandr [17]

Answer:

8155.63844394

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • Your company is developing a new marketing campaign and wants to know which customers have never placed an order. You will need
    10·1 answer
  • To what device, inside the computer, do all other devices connect
    10·2 answers
  • Write the pseudocode for linear search, which scans through the sequence, looking for ν. Using a loop invariant, prove that your
    14·1 answer
  • Another html/css assignment, drop css code below, thank you
    15·1 answer
  • Perform the following conversions from decimal to binary, octal and hexadecimal systems. a) 1710 b) 132110C) 36010d).7510e).3906
    8·1 answer
  • How have productivity programs improved the professional lives of people? (check all that apply)
    8·2 answers
  • In linear​ programming, what are restrictions that limit the degree to which a manager can pursue an​ objective?
    15·1 answer
  • Several NEC® sections contain the requirement to size conductors and overcurrent devices at 100 percent of the noncontinuous loa
    15·1 answer
  • What are the 3 rules of music<br><br> ps: there is no music subject so i had to put something else
    15·2 answers
  • 20 POINTS! Which music making software is better? Ableton Live or Logic Pro? Name the advantages and disadvantages of each one!
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!