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
Topological sort requires only a tiny addition to the DFS algorithms. Exactly one of the following data structures is required t
Alekssandra [29.7K]

Answer:

Stack.

Explanation:

Topological sort requires a bit of addition to DFS algorithm.So DFS can be done by two ways that are either you can use recursion or you can use Stack data structure to implement DFS.

Since recursion uses stack memory when it makes recursive calls and if you want to do it iteratively you can stack data structure.

8 0
2 years ago
Need help asap<br> give the correct answer!!
blagie [28]
It’s either b or c, but my final answer would be C
4 0
2 years ago
Read 2 more answers
The Twitter website has become a de facto first source for many important events in the last decade. Twitter's hashtag feature l
timurjin [86]

Answer:

..........................................?

7 0
2 years ago
Read 2 more answers
In attempts to improve their contribution to the environment, a company decided to adapt to green computing. Which of these tech
timama [110]

Answer:

All of them apply

Explanation:

Green computing is the process of using environmental friendly computers and its associated components, accessories and other supporting devices.

Virtualization helps us to reduce the number of hardware that we are using.

Grid computers helps us to reduce the use of number of machines and thus supporting the environment in a right way.

Recycling process. Any material that we use needs to be recycled effectively and also in an environmental friendly way.

Autonomic computing uses eco-friendly system which in turn hugely support green computing.

8 0
3 years ago
What are the advantages and disadvantages of using a very large memory cell size, say, W = 64 instead of the standard size W = 8
stepladder [879]

Answer and Explanation:

  • The benefits of an large size memory cell is that you can store a lot bigger numbers (and all information is, eventually, numbers) in one cell, which by and large improves the speed and unwavering quality of information get to.  
  • The inconvenience is that you go through a bigger bit of whatever information stockpiling medium you are utilizing on each expression of information, and accordingly can store less information generally speaking.  
  • The biggest positive integer that could be put away in a framework utilizing sign/size documentation, with 64-piece cells is 263. On the off chance that two such cells were utilized to store numbers, the biggest whole number that could be put away by the framework is 2127.
7 0
2 years ago
Other questions:
  • Which is the most efficient way to italicize a row of text in every worksheet in a workbook?
    8·1 answer
  • For a wire with a circular cross section and a diameter = 3.00mm calculate the following: (m means meter. mm means millimeter. c
    5·1 answer
  • Micheal has increased the contrast of the given picture. Which feature or menu option of a word processing program did he use? A
    15·1 answer
  • How does kinetic energy affect the stopping distance of a small vehicle compared to a large vehicle?
    14·2 answers
  • Write a pseudocode thats accept and then find out whether the number is divisible by 5 ​
    6·1 answer
  • . In the BorderLayout class, what are NORTH, SOUTH, EAST, WEST, and CENTER?
    15·1 answer
  • Que se puede observar en el escritorio de windows
    8·1 answer
  • JPG is considered a lossy file format. What does this mean?
    15·2 answers
  • What is the output of the following program? If there is any problem, how can
    13·1 answer
  • What are 6 subtopics on computer programming ?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!