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
What is the reason of non-deterministic (indeterminate) behavior of concurrent programs?
murzikaleks [220]

Answer: Concurrent programs are the programs that execute at the same point of time. They are simultaneous in nature with other concurrent programs.They are executed with the help of threads  to achieve the concurrency without the issue of scheduling. They are consider long running programs.

The program that has the low execution time compared with all other programs gets executed first.If the case of no progress is seen then another thread is executed.This type of execution gives the non- deterministic situation in which the possibility of leading completion of any particular program cannot be determined.

5 0
3 years ago
How does the use of imagery create meaning
Contact [7]

Imagery is a feature of written and spoken language and occurs whenever someone has chosen to use language in a non-literal way.

Imagery is a way of describing something symbolically, using words to create a picture in the reader's imagination.

In the Close Reading paper you need to be able to recognise imagery and to consider how successful the imagery is at conveying to you what the writer is trying to express. Imagery frequently conveys more than just meaning. It is used to heighten the effect of language and is often an extension of word-choice. Normally an image will extend to a phrase or a few words but sometimes it will be longer. The simplest form of imagery to recognise is when something or someone is compared to something else, with the purpose of establishing some parallel between the two. Images of this kind frequently concern qualities like beauty, speed, force, power and natural and animal traits.

6 0
3 years ago
Read 2 more answers
Which two statements give good definitions of financial credit
iren2701 [21]
The two <span>statements that give good definitions of financial credit are :            1) Balance Sheet & 2) Income Statement.  
</span>
1) Balance sheet shows the assets, liabilities, and net worth on a
    given date;
2) Income statement (profit & loss account), shows how the net income of
    the firm is arrived at over a stated period. 
Another statement is Cash flow statement, which shows the inflows and outflows of cash caused by the firm's activities during a given period of time.
3 0
3 years ago
The introduction of the 8-bit computer expanded the number of bytes available for encoding. This led to the development of
Akimi4 [234]
It led to the development of octets.
8 0
3 years ago
When a file is double clicked what happens
Naddik [55]
I am pretty sure the file opens 
6 0
3 years ago
Other questions:
  • All of the following are incentives proprietary schools use to attract a student except
    7·2 answers
  • An unwanted 'explosion' of inbox messages is called​
    8·2 answers
  • The performance of a client-server system is strongly influenced by two major network characteristics: the bandwidth of the netw
    6·1 answer
  • One study found that nearly ____________ of the 1600 college freshmen surveyed had sent sexually suggestive texts or photos.
    11·1 answer
  • What is meant by polling mode in communication between software andUART and what is its disadvantage as compared to interrupt mo
    14·1 answer
  • Miguel owns a tile business. He has two employees who work in a small office. One answers phones and schedules appointments. Ano
    11·2 answers
  • 27. If X and Y are int type variables,
    14·1 answer
  • The term Linux Intrusion Detection System ( LIDS) refers to a command that allows an administrator to run processes as root with
    5·1 answer
  • High level language is___________
    15·1 answer
  • Write a program to output 3 lines of text with the following information:
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!