Cs201 Assignment 03 Solution 2021

0
664

Assignment No.  3
Semester: Fall 2020

Cs201 Assignment 03 Solution 2021

Total Marks: 20

Due Date:

29-01-2021

 

 

 

Instructions

Please read the following instructions carefully before submitting assignment:

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

 

Assignment is submitted after due date.

Submitted assignment does not open or file is corrupt.

Assignment is copied (From internet/students).

Assignment is not in .cpp format.

 

Software allowed to develop Assignment

 

–          Dev C++

 

Objectives:

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.
   

 

Cs201 Assignment 03 Solution 2021 Download 

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.

 

Problem Statement

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:

 

ENTER CHOICE

1.      ADD AN INVENTORY ITEM

2.      DISPLAY FILE DATA

3.      INCREASE QUANTITY

 

Prompt will show to the user for continue the program after dealing with each option, until user will press a key other than ‘y’.

 

Cs201 Assignment 03 Solution 2021 Download 

 

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:

 

class Inventory

{

private:

int itemID;

char itemName[20];

float itemPrice;

quantity;

float totalPrice;

 

public:

void readItem();

void displayItem();

int getItemID() ;

float getPrice() ;

float getQuantity() ;

void updateQuantity(float q);

};

//Deleting existing file

void deleteExistingFile(){——–}

//Appending item in file

void appendToFille(){————}

//Displaying items

void displayAll(){————}

//Increasing Quantity of item

void increaseQuanity(){————}

Program Output:

 1)      User’s prompt when program will execute for the first time.

2)      When user press ‘1’ ,  It will take data about an inventory item as an input from the user.

3)      When user press ‘2’, it will read data from “Inventory.txt” file and display record of all inventory items on the screen

4)      If user press ‘3’, it will ask to enter Item id against which user want to increase item quantity.

5)      Now, when the user will press ‘2’, the inventory item record will be shown as:

 

Cs201 Assignment 03 Solution 2021 Download 

Assignment#3 covers course contents from lecture 17 to 30.

 

Best of Luck!