Question: CE 1 0 2 Homework 2 Description: You are tasked with creating a C + + program for managing a virtual pet store. The program

CE102 Homework 2
Description:
You are tasked with creating a C++ program for managing a virtual pet store. The program should implement a simple user interface and utilize loops, if-else statements, and input-output functions. Your objective is to design and implement the following structure:
Pet Class:
Attributes:
name: string (private)
type: string (private)
age: integer (private)
hungerLevel: integer (private)
happinessLevel: integer (private)
Enum Definition:
Create an enum to represent different types of pets. The enum should include options such as "DOG", "CAT", "BIRD", etc., corresponding to common types of pets that can be managed in the virtual pet store program. Use this enum to specify the type of each pet when creating instances of the Pet class.
Member Functions:
Constructor:
Parameters: name (string), type (string), age (integer)
Functionality: Initializes the pet with the provided details and default hunger and happiness levels.
feed:
Parameters: None
Functionality: Increases the hunger level of the pet by a random amount (simulating feeding).
Returns: Integer representing the amount by which hunger level increased.
play:
Parameters: parameter playTime representing the duration of playtime in minutes.
Functionality: Increases the happiness level of the pet by a random amount (simulating playing)
Returns: Integer representing the amount by which happiness level increased.
displayStatus:
Parameters: None
Functionality: Displays the current status of the pet, including its name, type, age, hunger level, and happiness level.
Main Program:
The main program should create multiple instances of Pet objects representing different pets in the store.
It should provide a menu-driven interface allowing users to choose from the following options:
Feed a pet
Play with a pet
Display the status of a pet
Exit the program
The program should use loops to continuously prompt the user for inputs until they choose to exit.
Expected Output:
Submission Instructions:
Implement the program according to the provided requirements.
Submit your C++ source code file along with any necessary header files.
Test your program with different scenarios to ensure its correctness.
Include brief comments within the code segment to explain your design choices. These comments should provide insights into the rationale behind your coding decisions.
Please ensure that you include a code block comment containing your student ID, name, surname, and your favorite pet within your submission. Failure to include this information will result in your homework not being evaluated.
CE 1 0 2 Homework 2 Description: You are tasked

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!