0% found this document useful (0 votes)
16 views4 pages

Computer Science 0478 P22 Practice Questions

Uploaded by

Eman Bilal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

Computer Science 0478 P22 Practice Questions

Uploaded by

Eman Bilal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Scenario #1

You are a programmer working for a small company that sells custom-made t-shirts. The
company has recently received a large order from a school and needs to create a program
to help manage the order. The order contains t-shirts in four different sizes: small,
medium, large, and extra-large. Each size comes in two different materials: cotton and
polyester. The customer has requested that the t-shirts be sorted by size and then by
price within each size.
Your task is to create a program that will do the following:

● Sort the t-shirts by size and then by price within each size using bubble sort.

● Ask the user to enter the number of t-shirts in the order.

● Display the sorted t-shirts with the total cost of the order and the cost of each size

The program should use functions and procedures to perform the sorting and to calculate
the total cost of the order. The price of each t-shirt is as follows:

Small Medium Large Extra Large

Polyester 8 12 15 18

Cotton 10 13.50 16 20

Your program should also include appropriate input and output statements to interact
with the user.
You are working as a programmer for a medical research organization, which is currently
studying the prevalence of different diseases in a particular population. The organization
has collected data from different clinics about patients who have been diagnosed with
these diseases.
Scenario #2
The 2D array PatientDetails stores the following data:

Alcohol
Patient ID Name Gender Disease Smoker
Consumer

The 1D array ages stores the ages of all the patients and the 1D array MedicalScores
stores the medical history score of each patient. All patients have the same position in
each array, for instance, the patient at number 4 in PatientDetails will be 4 at ages
and in MedicalScores. The variable PatientCount stores the number of patients.
Your program should include the following procedures:

● A procedure called "disease_counter" that calculates the total number of


patients diagnosed with a certain disease as per the user’s request.
● A procedure called "average_age" that calculates the average age of male and
female patients separately.
● A procedure called "smokers_percentage" that calculates the percentage of
patients who have a history of smoking.
● A procedure called "alcohol_consumers" that calculates the percentage of
patients who have a history of alcohol consumption.
● A procedure called "young_old" that finds the age of the youngest and oldest
patient diagnosed.
● A procedure called "highest_medical_score" that finds the name of the patient
with the highest medical history score.
● A procedure called "search_patient" that allows the user to search for a
particular patient using their unique identifier.
You must use pseudocode or program code and add comments to explain how your code
works.
All inputs and outputs must contain suitable messages. You do not need to initialise the
data in the 2D array patient_details or the 1D array MedicalScores or the variable
PatientCount.
Scenario #3
You have been hired to develop a program for a food truck that will keep track of customer
orders and calculate the bill. The food truck has a menu with 5 different items and prices,
as well as a set of promotions that are applied to certain combinations of items. Your
program should be able to perform the following tasks:

● Display the menu to the user

● Allow the user to input the menu items, however, the customer is not allowed to
order more than 3 pieces per item at once
● Keep track of the items selected by the user and calculate the total cost of the
order
● Apply any applicable promotions to the order and calculate the final discounted
price; there are no limits on the number of discounts applied for the sake of this
program
● Print out a receipt showing the details of the order, including the items selected,
the original price, any discounts applied, and the final price
The menu includes:

● Chicken burger which is for $5.99

● Pizza which is for $8.99

● Salad which is for $4.50

● Fries which is for $3.25

● Soda which is for $1.25

There are 2 promotions available to customers:

● 1 Burger and 1 Fries combo is $3

● 1 Pizza and 1 Soda combo is $4.50

You must use 1D and 2D arrays throughout your program where needed.
You must use pseudocode or program code and add comments to explain how your code
works. Your program should also include appropriate input and output statements to
interact with the user. Include proper validation checks throughout the program to
maintain efficiency.

You might also like