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
Unlike the climate of the other islands of Hawaii, ________Kona contains 54 different temperate zones.
kramer

Answer:

<u>None</u>

Explanation:

Great question, it is always good to ask away and get rid of any doubts that you may be having.

Unfortunately, none of these answers would be factually nor grammatically correct. For Starters Kona is not an island Kailua-kona is the capital town of the Big Island in Hawaii.

Regardless of that fact, none of the answers given would make the sentence make sense grammatically. The Only way for the sentence to make sense grammatically, the answer either needs to stay blank or be Kailua. Like so...

Unlike the climate of the other islands of Hawaii, <u>Kailua</u> Kona contains 54 different temperate zones.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

6 0
3 years ago
The _____________ loop allows the receiver to communicate with the sender in the imc process.
postnew [5]
Feedbacks
perhaps !!
<span>The feedback loop allows the receiver to communicate with the sender in the imc process.</span>
4 0
3 years ago
The internet has provided great opportunities for fundraising. true/false
alekssr [168]
True, sites such as kickstarter and just giving are fantastic examples of such.
8 0
3 years ago
The main advantage of using the Gray code is:
zzz [600]

Answer:

a) only one digit changes as the number increases.

Explanation:

Let us first understand what does it mean when we say only one digit changes as the number increases using the Reflected Binary code (also called Gray code)

consider the 4 bit representation of Binary coded decimal and RB codes

Decimal | Binary code  | Reflected binary (RB) code

0              0000               0000

1               0001                0001

2              0010                0011

3              0011                 0010

4              0100                0110

5              0101                 0111

As you can see in the case of binary codes, there are more than one digit changes between two consecutive numbers.

But notice that in the case of Gray codes, there is always one digit change between two consecutive numbers.

The problem with the binary codes is that the more digits change there states the greater is the chance of ending up with random transitional values rather than real values which can be incorrect. The RB code solves this problem by only changing one digit at a time.

The RB code is widely used in linear and rotary encoders, error correction and digital logic design.

8 0
3 years ago
When spark plug cables aren't far enough apart, premature firing of adjacent spark plugs can happen. this is known as?
e-lub [12.9K]
Misfiring seems to be a blanket term for spark plug inefficiencies and errors due to wrong gap configuration. Because of the small gap, the time <span>of the spark has less travel distance, it does not remain hot enough to ignite the air-fuel mixture that is needed to run the engine. </span>
7 0
3 years ago
Other questions:
  • What output is produced by the following code fragment int num = 1 max = 20 while num &lt; max?
    7·1 answer
  • Two positive outcomes generally associated with modern computing are greater _____.
    12·2 answers
  • Which command is used to encrypt all passwords in a router configuration file?
    6·1 answer
  • By
    7·1 answer
  • PLEASE HELP 17 POINTS AND ILL MARK BRAINLIEST IF CORRECT , DONT GUESS
    13·1 answer
  • Positive use of the technology before the pandemic.
    8·1 answer
  • Explain how mobile phone production could be more sustainable​
    8·2 answers
  • Mi amiga es una chica y es soltera y quiere novia, a cualquiera le interesa?
    11·1 answer
  • What is the purpose of a computer network needs assessment? to evaluate how to move from the current status to the desired goal
    15·1 answer
  • The internet is controlled by ______
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!