Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.


Please read the following instructions carefully before solving & submitting assignment:

It should be clear that your assignment will not get any credit (zero marks) if:

  • The assignment is submitted after due date.
  • The submitted assignment is other than .cpp file.
  • The submitted assignment does NOT open or file is corrupted.
  • The assignment is copied (from other student or ditto copy from handouts or internet).

Uploading instructions


  • For clarity and simplicity, you are required to Upload/Submit only one .CPP file


The objective of this assignment is:


  • To give you the idea of practical implementation of overloading different operators.


For any query about the assignment, contact at










Marks: 20 

Problem Statement:

Consider the following class from the scenario discussed in assignment no. 1,



Being a part of development team, you are given the task to develop a form for the VU Accounts Department which is used to enter fee structure of different degree programs (Master, BS and Diploma etc).


Your task is to, write a C++ program which implements FeeStructure class and operator overloading with attributes and operations (functions) given in the above class structure.


Solution Guidelines:


  1. Create (Declare) a class with data members and member functions given in the above class.


  1. Overload the stream extraction operator (>>) for the class, so that you could use the statement like, cin>>Master_Fee; where Master_Fee is an object of FeeStructure class.



  1. Overload the plus binary (+) operator for the class, so that you could use the statement like,

Total_Fee = Master_Fee + BS_Fee + Diploma_Fee ; where Total_Fee, Master_Fee, BS_Fee, Diploma_Fee are objects of FeeStructure class.


  1. DisplayFee() member function displays the fee structure of each object (degree program).


  1. In main function create different objects of FeeStructure class, read values for these objects from keyboard.


  1. Also create an object which adds fees of different Degree programs like,

         Total_Fee = Master_Fee + BS_Fee + Diploma_Fee ;


  1. Call the DisplayFee() member function for all objects created in the program.








Sample Output:




Note:  This assignment is Non Graded, which means its mark will not be considered in final grading, however, you are required to solve it and UPLOAD/Submit on LMS.


Lectures Covered:  This assignment covers Lecture #    16-21

Deadline:             Your assignment must be uploaded/submitted at or before. January 08, 2014



Views: 9534

Replies to This Discussion

Please Discuss here about this assignment.Thanks

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions.

This Assignment is Next stage of Assignment No 2.... see assignment No 2 solution and share your views here about assignment no 2

the assignment  is easy check the solution of Assignment 2 and just a one step forqrd we have to overload ,>> and + operators 


@ Mubashir..

Why have you declared the extraction operator overloading function as FRIEND?

and please tell me how to declare it inside the class FeeStructure?

The code I have given for extraction operator overloading have both declaration and definition together. Just write this inside the class.

suppose if I have not declare it as a friend function then we have to write

object_name >> cin;

if we write

cin >> object_name;   // error

object_name >> cin >> object_name2;   // error

but when we declare it as a friend function then we pass it two parameters one is ostream and other is a FeeStuc object. and now we can use it as

cin >> object_name;

cin >> object_name >> object_name2;

Read Lecture 19 for more detail

Thanks For Sharing it's very helpful 

What does t("Total") mean?

if "t" is an object of class FeeStruc then what does ("Total") mean?

tell me anybody please :(

"t" is just a temporary object of FeeStruc class. 

FeeStruc class has data member degName. I have created a parametrized constructor in the class which take a character string as a parameter and assign it to degName of object.

so when we have to create an object we can pass it a character string to set degName.

and FeeStruc t("Total") means that I am creating an object by passing a parameter.

You have to do the same in main function when declaring any other object like Master_Fee or BS_Fee.

FeeStruc BS_Fee("BS");

Mubashir Saeed plz give me (total function) definition.

I haven't used any function for totalizing the fees instead I have created a data member total in the class and used it in definition of stream extraction operator overloading for totalizing all the fees. but if you want to use a function for totalizing then here is the code


// Declaration

int totalfee();


// Defination

int FeeStruc::totalfee(){

int total;

total = regFee + admFee + secFee;

return total;



// Funtion calling in main for total fee goes like this

FeeStruc BS;



use it in cout to return the value of total fee

degree name         registFee            -                  -                     -

Master                 2000

Bs                       2000


Total                   4000       // Mubashir Saeed how u add total here??? 

                                            i need code for that.

First u have to overload + operator by the code I have given above.

then in main declare 4 objects of FeeStruc class. Three for fees and forth for total fee.

now, because u have overloaded + operator so you can do the addition of objects like

Total_Fee = Master_Fee + BS_Fee + Diploma_Fee;

and then simply use dispfee(); function to display the Total_Fee object.


© 2022   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service