Assignment No. 3
Semester: Fall 2020
CS201 – Introduction to Programming Total Marks: 20
Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:
o Assignment is submitted after due date.
o Submitted assignment does not open or file is corrupt.
o Assignment is copied (From internet/students).
o Assignment is not in .cpp format.
Software allowed to develop Assignment
In this assignment, the students will learn:
• Use of class in programming
• How to deal with a file in programming
• How to implement switch statement for Class based functions.
ABC bakery is using a console based inventory management system for the receipt generation purposes. Console application will help the cashier in calculating total price of each item with respect to its price. Menu list will provide Add an item option to take data about an inventory item, include Item Id, Item name, price and quantity. Relevant data of all items will be displayed on screen with the help of menu option. Quantity amount of items will changeable if user wants to add quantity of an item.
Write a C++ program to manage the inventory item using your knowledge about file handling and classes. User will manage details of an Inventory item using menu list that will provide three options:
ADD AN INVENTORY ITEM
DISPLAY FILE DATA
Prompt will show to the user for continue the program after dealing with each option, until user will press a key other than ‘y’.
Instructions to write C++ program:
You will use class “Inventory” to declare inventory data and info
Make “Inventory.txt” file to save inventory item record
“Inventory.txt” file will delete each time when the program will run
“ERROE IN OPENING FILE” will be shown if user not press ‘1’ when program will execute first time.
You will use switch statement to handle different conditions and to perform different actions based on the different actions, that is, choice 1, 2, and 3.
Code structure [ Demonstration]:
You will be using the following class and other functions to develop the assignment: