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 objective of this assignment is:
For any query about the assignment, contact at CS304@vu.edu.pk
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.
Total_Fee = Master_Fee + BS_Fee + Diploma_Fee ; where Total_Fee, Master_Fee, BS_Fee, Diploma_Fee are objects of FeeStructure class.
Total_Fee = Master_Fee + BS_Fee + Diploma_Fee ;
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
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
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.
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
total = regFee + admFee + secFee;
// Funtion calling in main for total fee goes like this
use it in cout to return the value of total fee
degree name registFee - - -
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.