Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 17th, 2005, 9:33 AM   #1
Alice_T
Newbie
 
Join Date: Jan 2005
Location: Sarawak,MAlaysia
Posts: 1
Rep Power: 0 Alice_T is on a distinguished road
How to create program c++?

How to create a base class called MammalClass which each mammal has an age (private data member is Age) and a weight. Also the code for constructors that can instantiate mammals with age 0, a public member function which can set the age of the mammal.

Also include a function called Sound() which outputs "Mammal Sound", Sleep() which outputs "Mammal is sleeping", Eat() which outputs "Mammal is hungry".
How to create this program using c++?


Thanks a lot for ur all attention.....
Alice_T is offline   Reply With Quote
Old Jan 17th, 2005, 5:16 PM   #2
Tama
Programmer
 
Join Date: Dec 2004
Posts: 35
Rep Power: 0 Tama is on a distinguished road
What have you tried so far? This is about as basic as it gets, and any book on C++ will cover the syntax necessary to do it.
Tama is offline   Reply With Quote
Old Jan 17th, 2005, 5:29 PM   #3
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
Sounds a lot like a homework problem to me.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower
Mjordan2nd is offline   Reply With Quote
Old Jan 17th, 2005, 5:44 PM   #4
Xero
Hobbyist Programmer
 
Join Date: Dec 2004
Location: a cardboard box
Posts: 118
Rep Power: 4 Xero is on a distinguished road
Probably is a homework problem

first half of the page should have everything that you need
http://www.cplusplus.com/doc/tutorial/tut4-1.html
Xero is offline   Reply With Quote
Old Jan 18th, 2005, 3:56 AM   #5
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 5 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
lol, you think the way the assignment is structured, just read the first 10-30 pages of most c++ programming books and you will have the answers.
Berto is offline   Reply With Quote
Old Jan 18th, 2005, 8:27 AM   #6
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,453
Rep Power: 7 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
I wish you would do you're homework yourself, or at least show us that you tried by posting some code. People that post up a homework assignment without trying it themselves first / telling us what problem they are having with their attemp at it... kinda annoys me. Afterall, are you going to ask your co-workers to do your assignments for you when/if you get a job in the industry?

Show us what you have tried, then I'd be glad to assist with any errors you may have.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Jan 18th, 2005, 10:06 PM   #7
codetaino
Programmer
 
codetaino's Avatar
 
Join Date: Jan 2005
Location: Bayamon, Puerto Rico
Posts: 71
Rep Power: 4 codetaino is on a distinguished road
A good option would be search over google for a "c++ class template" or "c++ class syntax" or something like that... from your writing i could deduce one or two things... or you wrote the exact assignment as they asked it or you have some knowledge in programming in the theory behind OOP... if the correct one is the latter... the syntax for a class in c++ is all you need.
__________________
"God bless u all" :)
codetaino is offline   Reply With Quote
Old Jan 19th, 2005, 5:28 AM   #8
Benoit
Expert Programmer
 
Benoit's Avatar
 
Join Date: Sep 2004
Location: Ontario, Canada
Posts: 548
Rep Power: 4 Benoit is on a distinguished road
Quote:
Originally Posted by Alice_T
How to create a base class called MammalClass which each mammal has an age (private data member is Age) and a weight. Also the code for constructors that can instantiate mammals with age 0, a public member function which can set the age of the mammal.

Also include a function called Sound() which outputs "Mammal Sound", Sleep() which outputs "Mammal is sleeping", Eat() which outputs "Mammal is hungry".
How to create this program using c++?


Thanks a lot for ur all attention.....
This sounds a lot like a homework assignment...Around here you gotta attempt it first and show us what you got before we help you....That way you'll learn more

welcome to the forums btw
__________________
Johnny was a chemist's son but Johnny is no more, for what Johnny thought was H2O was H2SO4
Benoit is offline   Reply With Quote
Old Jan 19th, 2005, 2:56 PM   #9
bl00dninja
Programming Guru
 
bl00dninja's Avatar
 
Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5 bl00dninja is on a distinguished road
Thumbs down

i actually might code this if i get drunk enough (i've only had 5) but yeah, this is exactly the type of crap i was talking about before.
__________________
i put on my robe and wizard hat...

Have you ever heard of Plato, Aristotle, Socrates?...Morons.
bl00dninja is offline   Reply With Quote
Old Jan 19th, 2005, 3:10 PM   #10
Xero
Hobbyist Programmer
 
Join Date: Dec 2004
Location: a cardboard box
Posts: 118
Rep Power: 4 Xero is on a distinguished road
Quote:
Originally Posted by bl00dninja
i actually might code this if i get drunk enough (i've only had 5) but yeah, this is exactly the type of crap i was talking about before.
You can't get drunk off water. Nice try though.
__________________
...
Xero is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:13 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC