Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Each program specifies a file name You must use that file name and also include a comment in your code You may use C+ styles

Each program specifies a file name You must use that file name and also include a comment in your code You may use C+ styles for 1/O, Strings and dynamic memory management Problem 8 with the problem number you received You are to create a class called Snake.

You should create the definition of the class Snake in a file snake h and the functions for Snake in snake.app. You will also create a main program to be housed in snakemain.cpp

A Snake will have attributes of: Breed, Weight, Name, Gender, Favorite Food,Length . Color description (this could be more than a single word), Other comments(also more than a single word)

A Snake will have the following methods:

Accessors for all attributes

Mutators for all attributes

A default constructor that sets all data elements to 0 or blank text as appropriate

A fully specified constructor that allows defining values for all attributes

A printinfo method that will display all the info for a snake in a logical and well formatted way including labels for each of the attribute fields

snakemain.cpp should perform the folowing actions: Dynamically allocate an array of 5 Snakes Prompt the user for information about each of the five snakes and store that information in one of the array elements Print the information for each Snake Clean up all allocated space.

comment on the meaning of every actions and use constructor, im studying for a test so would like to know how classes and objects should work.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions