Monday, 2 July 2012

CS201 VU Current Assignment No. 5 Spring 2012 Solution Soon

Assignment No. 05
Semester: Spring 2012
CS201: Introduction to Programming
Total Marks: 20
Due Date:05/07/2012
Objective:
The objective of this assignment is to provide hands on experience of:
> Using manipulators in C/C++
> Overloading stream insertion and extraction operators
Assignment:
Problem Statement: Customer Bill Information
Write a program that takes customer’s information from user i.e. name, ID and spending and displays the same customer information plus total bill on the screen. You will use the same Customer class implemented in Assignment#3. You need to overload stream insertion << and stream extraction >> operators for the Customer class.
Detailed Description:
> Use the same Customer class you implemented in Assignment#3.
> This time you don’t need the friend function for calculation of total bill according to spending.
> You can modify the class (add or delete some functions) as per program requirement.
> You will overload extraction operator >> for getting input for an object of Customer class.
> You will also overload insertion operator << for displaying the customer information on screen.
> On calling extraction operator in main() e.g. cin>>obj where obj is an object of Customer class, information about customer name, ID and spending should be taken from the user.
> Take a look at the sample output for better understanding.
> On calling insertion operator in main() e.g. cout<<obj, the output in the following format should be displayed.
> You must use the formatting manipulators setw() and setfill() for formatting the text as shown in the output.
> All the formatting of text should be implemented inside overloaded function for extraction operator <<
> The main() function of your solution should contain only these instructions
Customer obj;
cin >> obj;
cout << obj;
system(“pause”);