|
Assignment No. 03
Semester: Spring 2020
CS304- Object Oriented Programming
|
Total
Marks: 20
Due
Date: 6th August 2020
|
|||||||||||||
Objective
The objective
of this assignment is:
To give you the idea of practical
implementation of C++ Inheritance and Polymorphism.
Uploading instructions:
Rules for Marking:
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, execute or file is corrupted.
·
Your
assignment is copied from internet, handouts or from any other student.
(Strict disciplinary action will be
taken in this case).
Lectures
Covered:
This assignment covers Lecture # 22-29.
|
|||||||||||||||
Assignment No. 03
|
|
||||||||||||||
A public
sector university has its bookstores throughout the country from where
students can buy study material like handouts, lecture DVDs, books etc. Each
bookstore maintains the stock data of study material. This data is helpful
for the university to maintain information about quantity, price and other
data of each item available at different bookstores. Keeping in view the above scenario, you are required to write a C++ program that
should contain three classes: StockItem,
Handouts and Lecture_DVD, where StockItem should be base class and Handouts
and Lecture_DVD should be its derived classes.
You are required to use concept of Polymorphism to generate
the sample output. The detail of data members and member functions for each
class is provided in the given table.
Solution Guidelines:
Best
of luck!
NOTE: Do not put any query on MDB about this
assignment, if you have any query then email at cs304@vu.edu.pk. Furthermore, if any student found cheating
from any other student or from online forums then he/she will be awarded ZERO
right away and strict disciplinary action will be taken against the student.
|
|||||||||||||||
Deadline: Your
assignment must be uploaded/submitted on or before 6th August 2020
|
|||||||||||||||
Sunday, August 2, 2020
Friday, July 31, 2020
BUSINESS MATHEMATICS AND STATISTICS
MTH302 Assignment No.2 Solution Spring 2020
Question No.1
The marks obtained by 30 students in a subject are given
below.
15,16,20,21,22,31,35,40,45,22,26,29,18,41,49,43,48,23,28,32,36,38,24,29,30,46,42,44,25,50
Arranging the data into 8 classes with equal class interval
and then find the mean of this grouped data.
==================================================================
Wednesday, July 29, 2020
Instructions
Please read the following instructions carefully before solving &
submitting assignment:
It should be clear that your assignment will not get any
credit (zero marks) if:
o
The assignment
is submitted after due date or via email.
o
The submitted
assignment is other than .doc or .docx file.
o
The submitted
assignment does NOT open or file is corrupted.
o
The assignment
is copied (from other student or ditto copy from handouts or internet).
Uploading instructions
For clarity and simplicity, You are required to Upload/Submit
only ONE .doc
or .docx file.
Objective
The objective of this assignment is
o
To make you
familiar with the concept of a Complete binary tree and Heap Data structure.
GOOD
LUCK
Problem Statement:
Heap is a complete binary tree that conforms to the heap order.
The heap order is a property that states that in a (min) heap for every node
X, the key in the parent is smaller than (or equal to) the key in X and in a
(max) heap for every node X, the key in the parent is greater than (or equal
to) the key in X.
Given below is an array representing a complete Binary tree.
|
|
2
|
3
|
4
|
6
|
16
|
19
|
24
|
8
|
11
|
20
|
23
|
30
|
|
Data
Array index 0
1 2 3 4 5 6 7 8 9 10 11
12 13
Note: The data elements in the array have
been stored, starting from index 1.
a)
You are required to draw a complete binary tree from the above-given array. After drawing a
tree, identify which type of heap data structure is it showing either min heap or max heap?
b)
Let’s suppose, we insert a new value at an array index 13 then draw a heap tree after inserting a new node. Also, show the changes done in the array.
|
|
2
|
3
|
4
|
6
|
16
|
19
|
24
|
8
|
11
|
20
|
23
|
30
|
1
|
Data
Array index 0
1 2 3 4 5 6 7 8 9 10 11
12 13
|
Monday, July 27, 2020
Solution Code here
==============
#include<iostream>
using namespace std;
main()
{
int choice;
int quantity;
int price=0;
int bill=0;
char option;
cout<<"Fast Food Resturant Menu" <<endl;
cout<<"Enter 1 for Pizza (Rs. 999)" <<endl;
cout<<"Enter 2 for Burger (Rs. 250)" <<endl;
cout<<"Enter 3 for Sandwich (Rs. 150)" <<endl;
cout<<"Enter 4 for Paratha Roll (Rs. 200)" <<endl;
do
{
cout<<"Enter Your Choice according to menu : " <<endl;
cin>>choice;
cout<<"Enter quantity of selected : " <<endl;
cin>>quantity;
if(choice==1)
{
price = quantity * 999;
}
else if(choice==2)
{
price = quantity * 250;
}
else if(choice==3)
{
price = quantity * 150;
}
else if(choice==4)
{
price = quantity * 200;
}
else
{
cout<<"Invalid choice Please Try Again";
}
bill = bill + price;
cout<<"Do you want to select anyother item ? (y for Yes) : " <<endl;
cin>>option;
}while(option=='y' || option == 'Y');
float gst = (float) bill*19/100;
float total = bill + gst;
float discount=0;
if(total>1000)
{
discount=total*5/100;
total=total-discount;
}
cout<<"Price of Items : "<<bill <<endl;
cout<<"Amount of GST : "<<gst <<endl;
cout<<"Discount : "<<discount <<endl;
cout<<"Payable Amount : "<<total <<endl;
}
========================