|
Assignment No. 02
Semester: Spring 2016 Object Oriented Programming – CS304 |
Total Marks: 20
Due Date: July 21, 2016
|
Objectives:
To
get a hands on experience of using existing class as base class and implement
inheritance.
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 assignment is submitted via email.
§
The assignment is copied from Internet or
from any other student.
§
The submitted assignment does not open or file
is corrupt.
§ It
is in some format other than .cpp (Code File).
Note:
All types of plagiarism are strictly prohibited.
For any query about the assignment, contact
at CS304@vu.edu.pk
|
||
|
||
Case
Study
With the technological innovation, the world has become
a global village which enables us to contact people living far away from us.
Distances have shrunk and people use many courier services on daily basis to
send and receive gifts/letters/parcels. One of the popular courier services
in Pakistan is XYZ which delivers your parcels nationally and
internationally. Every parcel that is mailed by XYZ has some cost and weight
associated with it. Parcels can be divided into two sub-classes based on
their priority as urgentParcel and normalParcel. XYZ uses its own packaging
to ship every parcel depending on the type i.e. urgentParcels, normalParcels.
Parcel with urgentParcels type has some additional cost associated with it.
In this second iteration you are required to modify
existing application (developed in assignment 1) so that it should be able to
handle two different types of parcels called normal and urgent parcels. Now
normal parcel has one specialized attribute i.e. Per-gram charges for overweight
(this value will be entered by user)
All other attributes will be inherited from “Parcel”
class.
The formula to calculate total charges will be:
Total-charges =
Basic Charges
However, if weight is greater than 900g, then:
Total charges =
Basic Charges + (Per-gram charges for overweight * overweight)
Note: overweight = Total weight – 900. for weight
greater than 900 (as 900 grams is the minimum limit)
Similarly urgent parcel has two specialized attributes
i.e. Per-gram charges for overweight (this value will be entered by user)
and Urgent service charges per gram for overweight (this value will be
entered by user)
The formula to calculate total charges will be:
Total charges = (Basic
Charges + (50% of basic charges
for urgent service))
However, if
weight exceeds the minimum limit of 900grams, then total charges will be
calculated as follows:
Total charges = (Basic
Charges + (50% of basic charges
for urgent service)) + ((Per-gram
charges for overweight + Urgent
service charges per gram)* overweight)
Description of
attributes:
Basic
Charges: Minimum charges for parcel if weight
does not increase from our limit. In parcel class it is used as “fee” data member.
Per-gram
charges: It is for both normal and urgent
parcels. It is represented by “feePerGram”
data member in NormalParcel and UrgentParcel classes (as given in
code description below). These charges will apply when weight will exceed
from 900 grams.
Per-gram
urgent service charges: It is for urgent parcel only. It
is represented by “additionalFeePerGram”
data member in UrgentParcel class (as
given in code description below). These charges will apply in case of urgent
service when weight exceed from 900 grams limit.
50%
of basic charges for urgent service: These charges will
apply in case of urgent service in all cases (i.e. either weight exceeds
900grams or not)
Note that in case of urgent service,
if weight limit exceeds, both “Per-gram
charges” and “Per gram urgent
service charges” will be applicable whereas in case of normal service
only “Per-gram charges” is
applied.
Problem
Statement:
Develop an application in C++ that
should allow the user of application to enter the receipt number, sender
name, sender address, receiver name, receiver address, parcel weight, shipment
basic charges, fee per gram and additional fee per gram of parcel (in case of
urgent). Default weight limit without extra charges is 900 grams. After
getting required information generate a shipment receipt and display on console
screen.
To develop the application you need to
create classes with data member and member function as given below.
1.
Class NormalParcel:
Attributes or Data
Members:
Id:int
senderName:string
senderAddress:string
receiverName:string
receiverAddress:string
weight:int
fee:int
feePerGram:int
Methods/Operations/Getters/Setters:
Getter
and setter functions of all data members
Constructor
and Destructor
2.
Class UrgentParcel:
Attributes or Data
Members:
Id:int
senderName:string
senderAddress:string
receiverName:string
receiverAddress:string
weight:int
fee:int
feePerGram:int
additionalFeePerGram:int
Methods/Operations/Getters/Setters:
Getter
and setter functions of all data members
Constructor
and Destructor
Hint:
Use your exiting parcel class which can reduce the code of our new classes.
Lots of implementation is already given in parcel class. While inheriting
NormalParcel and UrgentParcel classes from Parcel class use only public
inheritance.
Note:
It
is compulsory to inherit from exiting parcel class which you made in first
assignment. Parcel class code which we made in first assignment is attached
with this assignment. You can use our provided Parcel class or you can also
use your created Parcel class.
Any student who will not
implement new requirement without inheritance or will not use Parcel class
from assignment no. 1 will get zero marks.
You will have to handle only feePerGram data member for NormalParcel class and feePerGram & additionalFeePerGram for UrgentParcel
class. Other data members are already implemented in Parcel class of assignment no. 1. You can use this class to implement solution of current
assignment.
Cheating
cases will be treated strictly. No laim excuses will be accepted.
Sample
Output:
For sample output watch “sample output demo.gif” video
attached with assignment.
|
||
BEST OF LUCK
|
estion # 1 of 10 ( Start time: 03:03:55 PM ) Total Marks: 1 Divide-by-32 counter can be acheived by using Select correct option: Flip-Flop and DIV 10 Flip-Flop and DIV 16 Flip-Flop and DIV 32 DIV 16 and DIV 32 Question # 2 of 10 ( Start time: 03:05:20 PM ) Total Marks: 1 The counter states or the range of numbers of a counter is determined by the formula. (“n” represents the total number of flip-flops) Select correct option: (n raise to power 2) (n raise to power 2 and then minus 1) (2 raise to power n) (2 raise to power n and then minus 1) Question # 3 of 10 ( Start time: 03:06:36 PM ) Total Marks: 1 A 4- bit UP/DOWN counter is in DOWN mode and in the 1010 state. on the next clock pulse, to what state does the counter go? Select correct option: 1001 1011 0011 1100 Question # 4 of 10 ( Start time: 03:07:37 PM ) Tot...
i need assigment 401 just for idea ......plz guid me
ReplyDeletecs401 ??
Deletecs 301 also needed idea solution,,,,,,,,,,
ReplyDeletecs 301 also needed idea solution,,,,,,,,,,
ReplyDeleteyes cs 401.....
ReplyDelete