Computer Science 0478 P22 Practice Questions
Computer Science 0478 P22 Practice Questions
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.
● 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:
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:
● 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:
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.