NUST College of Electrical & Mechanical Engineering,
RAWALPINDI
Lab-Mid Exam
CS-107: Computer Programming
Total Marks: 30
Course Instructor: Dr. Farhan Hussain Time Allowed: 60 Minutes
Lab Instructor: Engr. Eman Fatima Degree & Syndicate: EE-46-B
Problem statement:
An online store wants to automate its billing system to streamline the checkout process for
customers and ensure accurate pricing. Suppose a customer walks into the store or visits the
online platform, adding multiple products to their cart. At the checkout, the system should
efficiently calculate the total cost of all purchased items, apply relevant discounts, and generate
the final bill. The store follows a discount policy where:
Purchases above 10,000 PKR receive a discount based on the last two digits of your
CMS ID.
Purchases between 5,000 PKR and 10,000 PKR receive a discount based on the first two
digits of your CMS ID.
Purchases below 5,000 PKR receive no discount.
To implement this, the system should first allow the customer to enter the number of items they
are purchasing. Then, using an array, it should store the price of each item and compute the
total bill. The system must ensure data validity, if a customer mistakenly enters a negative
price, the system should detect this and allow them to re-enter a valid amount. A user-defined
function should be used to apply the appropriate discount based on the total purchase amount.
After processing the purchase, the program should display the original total amount, discount
applied, and final bill in a user-friendly manner. To make the system more interactive,
customers should be given the option to make another purchase after completing one transaction,
allowing the program to run continuously until the customer chooses to exit.
General Instructions
Understanding the question is part of the exam, attempt as per your best comprehension.
This is a strictly Closed Book exam, accessing Lab Manuals, Lab reports, Lecture Slides,
personal notes or any other resource from LMS or elsewhere is not allowed.
Use of Gen. AI platforms, including but not limited to ChatGPT, is not allowed.
Page 1 of 1
RAWALPINDI
Lab-Mid Exam
CS-107: Computer Programming
Total Marks: 30
Course Instructor: Dr. Farhan Hussain Time Allowed: 60 Minutes
Lab Instructor: Engr. Eman Fatima Degree & Syndicate: EE-46-B
Problem statement:
An online store wants to automate its billing system to streamline the checkout process for
customers and ensure accurate pricing. Suppose a customer walks into the store or visits the
online platform, adding multiple products to their cart. At the checkout, the system should
efficiently calculate the total cost of all purchased items, apply relevant discounts, and generate
the final bill. The store follows a discount policy where:
Purchases above 10,000 PKR receive a discount based on the last two digits of your
CMS ID.
Purchases between 5,000 PKR and 10,000 PKR receive a discount based on the first two
digits of your CMS ID.
Purchases below 5,000 PKR receive no discount.
To implement this, the system should first allow the customer to enter the number of items they
are purchasing. Then, using an array, it should store the price of each item and compute the
total bill. The system must ensure data validity, if a customer mistakenly enters a negative
price, the system should detect this and allow them to re-enter a valid amount. A user-defined
function should be used to apply the appropriate discount based on the total purchase amount.
After processing the purchase, the program should display the original total amount, discount
applied, and final bill in a user-friendly manner. To make the system more interactive,
customers should be given the option to make another purchase after completing one transaction,
allowing the program to run continuously until the customer chooses to exit.
General Instructions
Understanding the question is part of the exam, attempt as per your best comprehension.
This is a strictly Closed Book exam, accessing Lab Manuals, Lab reports, Lecture Slides,
personal notes or any other resource from LMS or elsewhere is not allowed.
Use of Gen. AI platforms, including but not limited to ChatGPT, is not allowed.
Page 1 of 1