You are on page 1of 3

Question 1

b.) Given the following information concerning a Fruit Juice

Data Members Purpose

int product_code stores the product code number

String flavor stores the flavour of the juice (e.g., orange, apple, etc.)

String
stores the type of packaging (e.g., tera-pack, PET bottle, etc.)
pack_type

int pack_size stores package size (e.g., 200 mL, 400 mL, etc.)

int product_price stores the price of the product

Member
Purpose
Methods

constructor to initialize integer data members to 0 and string


FruitJuice()
data members to ""

to input and store the product code, flavour, pack type, pack size
void input()
and product price

void discount() to reduce the product price by 10


Member
Purpose
Methods

to display the product code, flavour, pack type, pack size and
void display()
product price

Required

i.) Implement a structure for the above scenario. (13)

ii.) Demonstrate how we can display for a specified number of Fruit Juices (10)

Question 2

A housing project has the following attributes registration number, name, type and
cost. The type of housing is determined by the cost given in a table below:

Cost in USD Type

Greater than or equal to $25000 Low Density

Greater than or equal to $15000 Medium Density

Less than $15000 High Density

Using structures write a program which will implement the above scenario
(13)

c.) Demonstrate how we can display information for a specific number of houses
(9)
Question 3

b.) An employee has the following information encumber, fullname, department and
employee type. There are 3 types of employees:

HourlyEmployee – An employee whose pay is based upon an hourly wage and


hours worked
SalaryEmployee – An employee whose pay is based upon a yearly salary
CommissionEmployee – An employee whose pay is based upon a commission rate
and sales amount

As a C++ expert the organisation has approached you to come up with a C++
program that captures and computes salaries of all employees.

i.) Implement the scenario above using structures


(13)
ii.) Demonstrate how we can specify the number of employees within the main and
compute the total salary bill. (9)

You might also like