Programming assignment is to tweak the existing mammal

Assignment Help C/C++ Programming
Reference no: EM13163649

programming assignment is to tweak the existing Mammal program and create your own Vehicle program.

sample program:

#include <iostream>

using namespace std;


enum BREED {YORKIE, GERMAN, DANDIE, SHETLAND, DOBERMAN, LAB};

class Mammal
{  

public:

        Mammal() :itsAge(2), itsWeight(5) {}       // constructor
        ~Mammal(){}     // destructor          
       
        // accessors
        int GetAge() const {return itsAge;}
        void SetAge(int age) {itsAge = age;}
        int GetWeight() const {return itsWeight;}
        void SetWeight(int weight) {itsWeight = weight;}
       
       
        // other function members     
        void speak() const {cout << "Mammal sound!" << endl;}
        void Sleep() const {cout << "shhh. I'm sleeping. " << endl;}

protected:
          int itsAge;
          int itsWeight;
};


class Dog : public Mammal
{

public:
       Dog() : itsBreed(YORKIE){}       // constructor
       ~Dog(){}     // destructor       // accessors

       BREED GetBreed() const { return itsBreed;}

       void SetBreed(BREED breed) {itsBreed = breed;}
       int GetWeight() const {return itsWeight;}
       void SetWeight(int weight) {itsWeight = weight;}
   
      

        // other function members
       void WagTail() const {cout << "Tail Wagging.. " << endl;}
       void BegForFood() const {cout << " Begging for food " << endl;}

private:

           BREED itsBreed;
};
void main()
{
    Dog cooper;
    cooper.speak();
    cooper.WagTail();
    cout << "cooper is " << cooper.GetAge() << " years old. " << endl;

}


//Sample Run:
//Mammal sound!
//Tail wagging...
//cooper is 2 years old

 

This is a program that declares a class Mammal.

Class Mammal has all the generic attributes and functions.

Class Dog, inherits from class Mammal

At the beginning of the program, I am using and enumeration that is simply assigning integers from 0 to whatever the last value is

For example in

enum BREED {YORKIE, GERMAN, DANDIE, SHETLAND, DOBERMAN, LAB};

YORKIE will grab the value of zero and LAB will have the value of 5

I have used inline functions for most of the member functions because it cuts down on the amount of code, you do not have to do that if inline functions are not your favorites.

Copy and paste the program into your IDE and run it, it should run with no errors.

Then I would like you to modify the program and instead of Mammal and Dog, create a base class Vehicle and then create a class car that inherits from the class Vehicle.

You can have weight of the car, brand, topspeed, number of cylinders (e.g. 4 cylinders, V6, V8) and so forth

I would declare it as below:

enum Engine_Type {zero,one,two,three,four,five,V6,seven,V8};

in the enum above, I would be interested in four, V6, and V8, because they will take the values of 4, 6, and 8 repectively.

 

 

Reference no: EM13163649

Questions Cloud

Determine the values for m and l for the b+ tree : A B+-tree is to be stored on disk whose block size is 2048 bytes. The data records to be stored are 50 bytes, and their key is 4 bytes. Determine the values for M and L for the B+-tree. Assume pointers are 4 bytes each.
Let ll be a list of integers : Let LL be a list of integers. Use list comprehension to produce teh following lists. Each one should just take onel line. Anser questions as two comments.
Write a select statement that returns these columns : Write a SELECT statement that returns these columns from the Products table: The date_added column A column that uses the CAST function to return the date_added column with its date only (year, month, and day)
You will write a program that reads a text file : You will write a program that reads a text file, counts the number of words in the file, and the number of occurrences of each character. It will print to a file the number of words, and the number of occurrences of each character, as well as the ..
Programming assignment is to tweak the existing mammal : programming assignment is to tweak the existing Mammal program and create your own Vehicle program.
Program that uses an instance of the timeoff : Write a program that uses an instance of the TimeOff class you designed in Programming Challenge 5. The program should ask the user to enter the number of months an employee has worked for the company. It should then use the TimeOff object to calc..
Find the number of steps per revolution. : If a given stepper motor has a step angle of 5 degrees, find the number of steps per     Revolution.
Boolean algebraic multiple choice question : boolean algebric mulitiple choice question
What are the requirements regarding plaintext and ciphertext : Keeping the IV secret in OFB mode does not make an exhaustive key search more complex. Describe how we can perform a brute-force attack with unknown IV. What are the requirements regarding plaintext and ciphertext?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd