I have final exam tomorrow and i need some help
hello everyone...I really need ur help guys
i dont really understand C++ well...and i hav final exem tomorrow..hope u gonna help me :)
I have some questions :
many questions but hope u understand the situation coz my final exam tomorrow
Q1- what is the output?
Q2- Identify the following function header and explain the differences and it use:
Q3- Following is a class called Numbers, with a declaration of prototype for overloading operator+.
b) Assume result,first and second are all instances of the Numbers class,and perform the following statement:
iii. Which object is passed as an argument into the operator+ function?
Q4- Assume a class named Bird exists. Write the header for a member function that overloads the <operator for that class.
Q5- Write a Circle class that has the following member variables:
radius : a double
pi : a double initialized with the value 3.142
The class should have the following member function:
Default Constructor - that sets radius to 0.0
Constructor - Accepts the radius of the circle as an argument
setRadius - A mutator function for the radius variable
getRadius - An accessor function for te radius variable
getArea - return the area of the circle
print - to display circle's area
Q6- Write a Cylinder class that inherit from the Circle class and specifies additional variable named length to hold the cylinder's length value. This class must include function that calculate and return the value and surface's area. Redefine function print() from the class Circle class in order to get the following output:
Enter the circle's radius: 3
Enter the cylinder's length: 7
Circle's Radius: 3
Circle's Surface Area: 28.278
Cylinder's Length: 7
Cylinder's Volume: 197.946
Cylinder's Surface Area: 131.964
Cylinder's Volume = length * pi * radius * radius
Cylinder's Area = 2 * length * pi * radius
Write a program that demonstrates the Cylinder class by asking the user for the circle's radius, cylinder's length and creating a Cylinder object.
Q7-(Template) Write a complete C++ program as follows.
# First write a class template couple that can be instantiated to hold two
values of two different types.The template should provide a constructor and
two simple access function.
# Next write a class template ThreeTime that can be instantiated to hold three
values of three different types.The Times template should be derived from the
couple tenplate. It should provide a constructor and three simple access
# Finally write a main function that creates and uses a couple object and a ThreeTime object. The pair should hold an integer value and a string value,and the triple should hold a character value and a double value and a Boolean value.
Invoke the access function and print all values in both the couple and ThreeTime objects.
Re: I have final exam tomorrow and i need some help
This site is called Go4Expert, not Go4GullibleIdiot, or Go4HomeworkAnswers, or Go4FreeConsultancyCosI'mTooLazyToStudy.
Q1 These are very easy. Do you *really* not know? If so then you have been slacking for the entire course and should fail the exam.
I suggest you put these into a compiler and see what comes out.
Q2 Read http://en.wikipedia.org/wiki/Virtual_function
It answers the question.
a: Very simple. I can't believe that on the day before your exam you can't write code to add two numbers. You deserve to fail. Sorry, but that's what I really think if you don't have this level of knowledge. Get a compiler and try writing the code yourself.
b(i): Also very simple. I'll give you the answer: No. You must now explain it. (Actually part ii gives you this answer, because if it was Yes then they'd have just given you the answer.)
ii/iii: Actually this is a really crap way of trying to write operator+. It should be a non-class method, needs to be a friend because it has to access private data, and takes two arguments so that you can use a=b+c semantics. Maybe the problem with this course is therefore not you slacking off but a crap teacher.
Q4. Strange question. How can one bird be "less than" another bird? But anyway, you only have to write the header, so look at question 3 and change plus to less than.
Q5. Er, very easy. Where are you stuck? *How* can you be stuck? You're given in very much detail what to do. "Write a Circle class" for instance, ok, how about:
>radius : a double
What, you're telling us you don't know how to define "radius: a double"? What about:
There's really no point going any further with this if you don't know how to define "radius: a double".
Q6. Easy, easy easy easy. Just have a go, OK? When you get stuck (and I mean AFTER trying it), post the code you have as a new thread and we'll help you out.
Q7. Not as easy as 6 but this is basic template stuff. If you have no idea where to start then you have no business being on the day before your final exam. Been slacking off, have we?
Re: I have final exam tomorrow and i need some help
OK, maybe I was a bit harsh, and shouldn't have assumed this problem was due to you slacking off. Maybe the problem is that you've got a crap teacher, and have in fact been trying your hardest. If this is the case then your fellow students should have similar problems and the pass rate should be very low across the whole class; you can take this as evidence of poor teaching to the head of the faculty.
So don't panic. Do your best, and if you fail then either (a) the teacher was crap or (b) this subject just isn't for you; sometimes no matter how hard you try you just can't get your head round something; don't worry about this and just focus on what you *can* do.
|All times are GMT +5.5. The time now is 12:03.|