CS201 Assignment 5: Overloading Stream Operators for Customer Class, Exercises of Computer Programming

Instructions for assignment 5 of cs201: introduction to programming, where students are required to overload stream insertion and extraction operators for a customer class. The objective is to gain hands-on experience with manipulators in c/c++. A problem statement, guidelines, and a detailed description of the assignment.

Typology: Exercises

2011/2012

Uploaded on 08/01/2012

parmitaaaaa
parmitaaaaa 🇮🇳

4.2

(111)

173 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Assignment No. 05
Semester: Spring 2012
CS201: Introduction to Programming
Total Marks: 20
Due Date:05/07/2012
Instructions:
Please read the following instructions carefully before submitting
assignment. It should be clear that your assignment will not get any credit
if:
The assignment is submitted after due date.
The submitted assignment does not open or file is corrupt.
Assignment is copied(partial or full)
f
rom any source (websites,
forums, students, etc)
Note: You have to upload only .cpp file.
A
ssignment in any other format
(extension) will not be accepted and will be awarded with zero marks.
F
or
example, if you submit code in .doc (Word document) or .txt files, no reward
will be given in any case.
Objective:
The objective of this assignment is to provide hands on experience of:
Using manipulators in C/C++
Overloading stream insertion and extraction operators
Guidelines:
Code should be properly indented and well commented.
Follow C/C++ rules while writing variable names, function names etc
Use only dev-C++ for this assignment.
Assignment
docsity.com
pf3

Partial preview of the text

Download CS201 Assignment 5: Overloading Stream Operators for Customer Class and more Exercises Computer Programming in PDF only on Docsity!

Assignment No. 05 Semester: Spring 2012 CS201: Introduction to Programming

Total Marks: 20

Due Date:05/07/

Instructions:

Please read the following instructions carefully before submitting

assignment. It should be clear that your assignment will not get any credit

if:

 The assignment is submitted after due date.  The submitted assignment does not open or file is corrupt.  Assignment is copied(partial or full) from any source (websites, forums, students, etc)

Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks. For example, if you submit code in .doc (Word document) or .txt files, no reward will be given in any case.

Objective:

The objective of this assignment is to provide hands on experience of:

 Using manipulators in C/C++  Overloading stream insertion and extraction operators

Guidelines:

 Code should be properly indented and well commented.  Follow C/C++ rules while writing variable names, function names etc  Use only dev-C++ for this assignment.

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#.  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.