Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is for C++ Create a database of four different types of pets (fish, dog, bi

ID: 3778053 • Letter: T

Question

This is for C++

Create a database of four different types of pets (fish, dog, bird, cat). Once the pet recommendation is made, have the program ask the user if they'd like to take this pet home. Have the program track how many pets that were suggested were actually taken. Write that out text file as well as the questions that were asked and their responses.

questions:

What Size – small, medium, large

Time (dedicated to pet) - a lot, some, little

Active – day or night

Walk – yes, no

Vocal – yes, no

Budget – under $100, $100 - $300, over $300

Fish

Dog

Bird

Cat

Size

Small

Small, medium, large

Small

Medium, Large

Time

Little

A lot

Little

Some

Active

No

Yes

Yes

Yes

Walk

No

Yes

No

No

Vocal

No

Yes

Yes

Yes

Budget

Under 500

1000+

500 – 1000

1000+

Fish

Dog

Bird

Cat

Size

Small

Small, medium, large

Small

Medium, Large

Time

Little

A lot

Little

Some

Active

No

Yes

Yes

Yes

Walk

No

Yes

No

No

Vocal

No

Yes

Yes

Yes

Budget

Under 500

1000+

500 – 1000

1000+

Explanation / Answer

***********************program**************************

#include<iostream>
#include<cstring>
#include <fstream>
using namespace std;
int main(){
   string size,time,active,walk,vocal;
   int budget,count=0;
   string choice;
   //file operations
   ofstream output;
output.open ("op.txt");
  
   do{
      output<<" What size of the pet you want(type smalll,medium,large):";
   //io operation
   cout<<" What size of the pet you want(type smalll,medium,large):";
   getline(cin,size);
   output<<size;
  
   output<<" Time dedicated to pet:(type little/alot/some)";
   cout<<" Time dedicated to pet:(type little/alot/some)";
   getline(cin,time);
   output<<time;
  
   output<<" Do you want active pet(type yes for active,else no):";
   cout<<" Do you want active pet(type yes for active,else no):";
   getline(cin,active);
   output<<active;
  
   output<<" Do you want a walking pet(type yes/no):";
   cout<<" Do you want a walking pet(type yes/no):";
   getline(cin,walk);
   output<<walk;
  
   output<<" Do you preffer Vocal pet(type yes/no)";
   cout<<" Do you preffer Vocal pet(type yes/no)";
   getline(cin,vocal);
   output<<vocal;
  
   output<<" Budget: Press 1.Under 500 Press 2.For 1000+ Press 3.For 500-1000 Press 4.For 1000+ ";
   cout<<" Budget: Press 1.Under 500 Press 2.For 1000+ Press 3.For 500-1000 Press 4.For 1000+ ";
   cin>>budget;
   output<<budget;
  
  
     
      if(size=="small" && time=="little" ){
          if( active=="no" && walk=="no" )
          cout<<"Suggested pet is Fish....!!!!";
      }  
   if((size=="small" || size=="medium" || size=="large")&& time=="alot" && active=="yes" && walk=="yes" &&vocal=="yes" &&budget==2)
       cout<<"Suggested pet is Dog....!!!!";
   else if(size=="small" && time=="little" && active=="yes" && walk=="no" &&vocal=="yes" &&budget==3)
   cout<<"Suggested pet is Bird....!!!!";
   else if(( size=="medium" || size=="large") && time=="some" && active=="yes" && walk=="no" &&vocal=="yes" &&budget==4)
   cout<<"Suggested pet is Cat....!!!!";
   cout<<" Do you want to take the pet...(press yes / no)";
   cin>>choice;
   if(choice=="yes")
          count++;
  
   cout<<" Do you want to continue(press yes-continue / no-exit)";
   cin>>choice;

   }while(choice=="yes");

cout<<"Total number of pets taken are:"<<count;
}

***********************console output***********************


What size of the pet you want(type smalll,medium,large):small

Time dedicated to pet:(type little/alot/some)little

Do you want active pet(type yes for active,else no):no

Do you want a walking pet(type yes/no):no

Do you preffer Vocal pet(type yes/no)no

Budget:
Press 1.Under 500
Press 2.For 1000+
Press 3.For 500-1000
Press 4.For 1000+
1
Suggested pet is Fish....!!!!
Do you want to take the pet...(press yes / no)yes

Do you want to continue(press yes-continue / no-exit)no
Total number of pets taken are:1
********************************file output***********************************


What size of the pet you want(type smalll,medium,large):small
Time dedicated to pet:(type little/alot/some)little
Do you want active pet(type yes for active,else no):no
Do you want a walking pet(type yes/no):no
Do you preffer Vocal pet(type yes/no)no
Budget:
   Press 1.Under 500
   Press 2.For 1000+
   Press 3.For 500-1000
   Press 4.For 1000+
1

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote