OOP MP (Edited)
OOP MP (Edited)
MICRO PROJECT
Academic year: 2021-22
Certificate
Seal of
Institution
Annexure - I
Roll No Individual
Sr. Process and Total
Name of Students Presentation
No. Product
assessment (06) (04) (10)
01
02
03
04
Sr.
Name of resources/Material Specifications Qty Remarks
No.
Processor: i3
1. Computer 1
RAM : 4.00 GB
2. Microsoft Word Word -2016
3. Printer Hp Laser Jet 1
Javapoint.com
4. Book/Site name
Wikipedia.com
2 Literature Survey .
Information Collection
3 Completion of the
Target as per project
proposal
4 Analysis of Data and
representation
5 Quality of
Prototype/Model/Conte
nt
6 Report Preparation
(B) Individual Presentation/Viva Out of 4
7 Presentation .
8 Viva
This Microproject would not have been possible without considerable guidance
and support so, we would like to acknowledge those who have enable us to
complete this project. Firstly we would like to thank our project guide,
the guideline with continuous advice and feedback throughout the duration of
finishing the project; their opinion and suggestion have helped us in a realizing
this project. Also, not to be forgotten, we would like to thank all our friends
with the report valuable opinion and sharing ideas during the process of this
project. Finally, we would like to thank our families for their understanding,
much
INDEX
1. Acknowledgement
4. Principles of OOP
5. Benefits of OOP
6. Program
7. Output
8. References
Introduction to Object Oriented
Programming
• Classes are user-defined data types that act as the blueprint for individual
objects, attributes and methods.
• Objects are instances of a class created with specifically defined data. Objects
can correspond to real-world objects or an abstract entity. When class is defined
initially, the description is the only object that is defined.
• Methods are functions that are defined inside a class that describe the behaviors
of an object. Each method contained in class definitions starts with a reference to
an instance object. Additionally, the subroutines contained in an object are called
instance methods. Programmers use methods for reusability or keeping
functionality encapsulated inside one object at a time.
• Attributes are defined in the class template and represent the state of an object.
Objects will have data stored in the attributes field. Class attributes belong to the
class itself.
Principles of OOP
Object-oriented programming is based on the following principles:
Start
Class Dept
Private:
int amount[m], pris[m], k,
a, b, amount1,code1,
cod[m], s, last, code;
Public:
float
price1,price; de
pt(void);
void sell(void);
void
total_items(void);
void add_old(void);
void add_new(void);
void show(void);
void menu(void);
int main();
End
//1246
//1247
//1248
#include <iostream>
#include <conio.h>
#include <stdlib.h>
#include <iomanip>
using namespace std;
const int m = 20;
class dept
{
int amount[m], pris[m], k, a, b, amount1;
int code1, cod[m], s, last, code;
public:
float price1, price;
dept(void);
void sell(void);
void total_items(void);
void add_old(void);
void add_new(void);
void show(void);
void menu(void);
};
dept::dept(void)
{
s = 0;
a = 10;
b = 40;
last = 5;
amount[0] = 0;
for (int k = 0; k < last; k++)
{
s = s + 1;
b = b + 10;
cod[k] = s;
amount[k] = a;
pris[k] = b;
}
}
void dept::add_old(void)
{
system("cls");
cout << "\nEnter item code:";
cin >> code1;
cout << "\nEnter item price:";
cin >> price1;
for (k = 0; k < last; k++)
{
if (code1 == cod[k])
{
a = a + 1;
amount[k] = a;
pris[k] = price1;
}
}
cout << "Enter 0 for Main menu ::";
}
void dept::add_new(void)
{
system("cls");
cout << "\nEnter item code:";
cin >> code1;
cout << "\nEnter amount of that item:";
cin >> amount1;
cout << "\nEnter item price:";
cin >> price1;
cod[last] = code1;
amount[last] = amount1;
pris[last] = price1;
last++;
cout << setw(40);
cout << "Enter 0 for Main menu ::";
}
void dept::show(void)
{
system("cls");
for (k = 0; k < last; k++)
{
cout << setw(40);
cout << "CODE:" << cod[k] << "\t";
cout << "AMOUNT:" << amount[k] << "\t";
cout << "PRICE:" << pris[k] << endl;
cout << endl;
}
cout << "//---------------------------------------------------------------------------------------------------
--------------\\" << endl;
cout << endl;
cout << setw(40);
cout << "Enter 0 for Main menu ::";
}
void dept::sell(void)
{
cout << setw(40);
cout << "Enter product code:";
cin >> code;
cout << setw(40);
cout << "Enter product price:";
cin >> price;
cout << endl;
}
void dept::total_items(void)
{
cout<<endl;
cout<<endl;
cout << setw(40);
cout << "ITEM CODE:"
<< code << "\t";
cout << setw(40);
cout << "ITEM PRICE:"
<< price << "\t";
cout << endl;
}
void dept::menu(void)
{
system("cls");
print.menu();
do
{
cin >> x;
switch (x)
{
case 1:
d[i].show();
break;
case 2:
d[i].add_old();
d[i].show();
break;
case 3:
d[i].add_new();
d[i].show();
break;
case 4:
system("cls");
cout << setw(40);
i++, j++;
cout << setw(40);
cout << "Item sold" << endl;
cout << endl;
cout << setw(40);
cout << "Enter 0 for Main menu ::";
;
break;
case 5:
{
system("cls");
cout << setw(40);
cout<<endl;
cout<<endl;
cout << "Money earned:"<<"\t";
s = 0;
Main menu.0
References::
Geeksforgeeks
Techtarget
w3schools