88.0k views
3 votes
he Animal Insurance Company:Writes a program that repeatedly prints the insurance fee to pay for a pet according to the following rules: A dog that has been neutered costs $50. A dog that has not been neutered costs $80. A cat that has been neutered costs $40. A cat that has not been neutered costs $60. A bird or reptile costs $10. Any other animal generates an error message.

User JeffLL
by
6.3k points

1 Answer

3 votes

Answer:

Program code is given below.

Step-by-step explanation:

#include <iostream>

using namespace std;03

int main()

{

char neutered, opselect, animal;

const int dogcost = 80, catcost = 60, birdOrReptilecost = 0;

cout << "What kind of animal do you have?\\";

cout << "d for dog, c for cat, b for bird or reptile and o for others.\\\\";

cin >> animal;

cout << "Answer the following questions\\";

cout << "With Y for yes or N for no.\\\\";

cout << "Is your pet neutered? ";

cin >> neutered;

cout << "Enter a select code: ";

cout << "\\1)A dog that has been neutered: ";

cout << "\\2)A dog that has not been neutered: ";

cout << "\\3)A cat that has been neutered costs: ";

cout << "\\4)A cat that has not been neutered costs: ";

cout << "\\5)A bird or reptile: ";

cin >> opselect;

switch (opselect)

{

case 1:

cout << "The price for dog that has been neutered is " << dogcost - 30;

break;

case 2:

cout << "The price for dog that has not been neutered is " << dogcost << endl;

break;

case 3:

cout << "The price for cat that has been neutered is " << catcost - 20 << endl;

break

case 4:

cout << "The price for cat that has not been neutered is " << catcost << endl;

break;

case 5:

cout << "The price for bird or reptile is " << birdOrReptilecost << endl;

break;

return 0;

}

User Dbrane
by
6.6k points