Tuesday, July 7, 2009

CS201 Intro to programing 6th july latest

Kindly do make vuhelps your default page and keep viewing it to get up to date information about current fresh exams. Also follow the blog. Send your papers to make them here uptodate at vuhelps@gmail.com or feel free to call at 03455242488
A function declaration has the same relationship to a function definition that
1 a class definition has to an object definition
2 an object declaration has to an object
3 a variable has to a variable declaration
4 a variable declaration has to the variable itself
5 they have no relationship

Write a function to overload subtraction operator for Class Order, which you created in
previous question. The class has following attributes/ data members
i) OrderID
ii) Items
iii) PricesOfItems
Write the main () to call the - operator and print the result also. This operator should subtract
the items of one object from the other.

What is the difference between an array and a structure?

What is this and ‘this’pointer?

When we write a class template the first line must be:
1 template < class class_type>
2 template < class data_type>
3 template < class T >, Here T can be replaced with any name but it is preferable.
4 class class-name()
5 class template

Create a class named Order. This class has the following attributes/ data members
i) OrderID
ii) Items
iii) PricesOfItems
a) Create the object of this class using parameterized constructor in order to initialize
OrderID and Items data members. Default values of both the data members must be
equal to 1.
b) Write the following member functions of this class;
i) OrderBill ( ), this function will calculate the invoice of an order and display the
result. The formula to calculate the invoice is
invoice=SumPrices();
ii) SumPrices( ), this function will sum the prices of the items entered by the user
from
keyboard in PricesOfItems array and returns the result.
c) Write the setter functions for OrderID, Items, and PricesOfItems. And getter functions
for OrderID and Items.
Also write the main () to create the object of class Order.

Write code that will declare, initialize, and fill in an array of objects of type int. After your code
executes, the array should look as follows.
0 2 4 6 8 10 12 14 16 18



Regards Vuhelps

No comments:

Advertisement