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
Anit [1.1K]
3 years ago
5

LAB: Count multiples (EO)

Computers and Technology
1 answer:
Elis [28]3 years ago
8 0

Answer:

public class Count {

Explanation:

You might be interested in
Need help with this C++ question
sertanlavr [38]

Answer:

Here is the improvement of the program:

#include<iostream>  //to use input output functions

using namespace std;// to identify objects like cin cout

int main()  {   //start of main function

  string pet;         // "cat" or "dog"  

  char spayed;       // 'y' or 'n'      

  // Get pet type and spaying information  

cout << "Enter the pet type (cat or dog): ";   //prompts user to enter pet type

  cin  >> pet;   //reads input pet type

  if(pet=="cat"|| pet=="dog")     {   //use OR operator to check the type

  cout << "Has the pet been spayed or neutered (y/n)? ";   //prompts user to input if pet been spayed or neutered

  cin  >> spayed;}   //reads input spayed value

  else   // display the message below

  cout<<"only cats and dogs need pet tags";        

  // Determine the pet tag fee  

if (pet == "cat")   //if type of pet is cat

  {  if (spayed == 'y' || spayed == 'Y')  //lowercase or upper case y is accepted  

        cout << "Fee is $4.00 \n";   //if spayed is y or Y

     else   //if spayed is not y or Y

        cout << "Fee is $8.00 \n";   }  

  else if (pet == "dog")   //if type is dog

  {  if (spayed == 'y' || spayed=='Y')   //if spayed is y or Y

        cout << "Fee is $6.00 \n";  

     else   //if spayed is not y or Y

        cout << "Fee is $12.00 \n";    }        

  return 0;   }

 

Explanation:

Step 1:

Here is the copy of original source code:

#include <iostream>

using namespace std;

int main() {

string pet;

char spayed;

cout <<"Enter the pet type (cat or dog): ";

cin >> pet;

cout <<"Has the pet been spayed or neutered (y/n)?" ;

cin >>spayed;

if (pet=="cat") {

if (spayed=='y')

cout<< "Fee is $4.00 \n";

else

cout<< "Fee is $8.00 \n"; }

else if (pet== "dog") {

if (spayed=='y')

cout<<"Fee is $6.00 \n";

else

cout<<"Fee is $12.00 \n";}

else  

cout<<"Only cats and dogs need pet tags";

return 0; }

Step 2:

Compile the program and then run it 7 times

Run       Input Data         Fee Information                                      Correct

 1                cat y               Fee is $4.00                                           Yes  

 2               cat n               Fee is $8.00                                           Yes    

 3               cat Y               Fee is $8.00                                           No

 4               dog y              Fee is $6.00                                           Yes

 5               dog n              Fee is $12.00                                         Yes

 6               dog Y              Fee is $12.00                                         No

 7              hamster n        Only cats and dogs need pet tags       Yes                

Step 3:            

See the Answer section

OR logical operator is used so that either a lowercase 'y' or an uppercase 'Y is accepted:

if (spayed == 'y' || spayed == 'Y')

program only execute the spay/neuter prompt and input when the pet type is cat or dog:

if(pet=="cat"|| pet=="dog")  

 {     cout << "Has the pet been spayed or neutered (y/n)? ";    

cin  >> spayed; }    

else    

cout<<"only cats and dogs need pet tags";      

Step 4:

Run       Input Data         Fee Information                                      Correct

 1                cat y               Fee is $4.00                                           Yes  

 2               cat n               Fee is $8.00                                           Yes    

 3               cat Y               Fee is $4.00                                           Yes

 4               dog y              Fee is $6.00                                           Yes

 5               dog n              Fee is $12.00                                         Yes

 6               dog Y              Fee is $6.00                                           Yes

 7              hamster         Only cats and dogs need pet tags          Yes  

In the last input hamster the program does not ask for spayed information. It only asks to Enter the pet type. When the user enters hamster the program displays the message: Only cats and dogs need pet tags.

4 0
4 years ago
Which code snippet is the correct way to rewrite this in Semantic HTML?
xxMikexx [17]

Answer:

<div id="header">

<h1>Waketech</h1>

</div>

<header><h1>Waketech</h1></header>

Explanation:

I think thats the answer your welcome

8 0
1 year ago
Which process best describes how you might prepare to apply for a job?
saveliy_v [14]
Take an online course,or maybe do special trainings,practice and study.
8 0
4 years ago
Read 2 more answers
(TCO G) _____ is when network managers deal with network breakdowns and immediate problems instead of performing tasks according
NeTakaya

Option D

Firefighting is when network managers deal with network breakdowns and immediate problems instead of performing tasks according to a well laid out plan.

<h3><u>Explanation:</u></h3>

Network management is a process of monitoring, operating and controlling the network. Various network managers spend most of their time firefighting- dealing with breakdowns and urgent problems.

If managers do not allocate enough time planning and organizing the network and networking staff, they are intended to be reactive rather than proactive in solving problems. A term that refers to reacting to network problems as they arise rather than relying on planned network management activity

4 0
3 years ago
A presenter selects multimedia materials primarily based on their ability to
Kisachek [45]
A presenter selects multimedia materials primarily based on their ability to emphasize a point.
7 0
3 years ago
Read 2 more answers
Other questions:
  • A car moves down the street at 45 kph. The driver takes his foot off the gas pedal but does not brake. Which is the correct expl
    5·2 answers
  • A server-side extension ________________. provides its services to the web server in a way that is totally transparent to the cl
    13·1 answer
  • A wide variety of “apps” are available to customize devices. Which category of app does word processing software fall into?
    14·2 answers
  • In which of these scenarios would the top 10 option be most helpful
    10·1 answer
  • What type of html list will automatically place a number in front of the items?
    9·1 answer
  • Problem 4 (25 points)Consider a byte addressing architecture with 64-bit memory addresses.(a)Which bits of the address would be
    5·1 answer
  • What technique is used when setup times at a workstation are sequence dependent?
    15·1 answer
  • Plz help me of this question​
    15·1 answer
  • what is the reason for assigning the management of file sharing, security, and quotas to administrators . why would it be pruden
    12·1 answer
  • An independent penetration testing company is invited to test a company's legacy banking application developed for Android phone
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!