0% found this document useful (0 votes)
17 views3 pages

Lab 4

The document outlines Lab 4 for the CSC3100 course, focusing on selection and control statements in programming. Students are required to modify existing Java programs to calculate BMI, total marks, internet bills, electricity charges, and product sales, among other tasks. Additionally, there are exercises related to employee eligibility, admission criteria, movie ticket pricing, discounts, and hotel booking policies.

Uploaded by

okuwobi
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)
17 views3 pages

Lab 4

The document outlines Lab 4 for the CSC3100 course, focusing on selection and control statements in programming. Students are required to modify existing Java programs to calculate BMI, total marks, internet bills, electricity charges, and product sales, among other tasks. Additionally, there are exercises related to employee eligibility, admission criteria, movie ticket pricing, discounts, and hotel booking policies.

Uploaded by

okuwobi
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/ 3

CSC3100 – PROBLEM SOLVING AND PROGRAMMING CONCEPTS SEM 2 2023/2024

Lab 4
Selection

Learning outcome:
At the end of this lab, student should be able:
solve the problem and develop a simple program using control statements.

Dateline: Week 5/6 – Observation and upload pre-programming and code to


Putrablast

** Copy or other forms of cheating is forbidden. The standard penalty for the first
offence is to award 0 to all parties concerned.

1. Modify the Java Program that you have developed in Lab 2 (question 5). Based on
the figure below, identify the status of the BMI.

Use console to display the information below:-


Sample output:
Enter your name: Aisyah
Enter your height in meters : 1.73
Enter your weight in kilogram : 66

Aisyah, your height is 1.73 meters and your weight is 66.00 kg.
Your BMI is 22.05, you are Normal.

2. Modify the Java Program that you have developed in Lab 3 (question 2) in
calculating the total mark of CSC3100. Add another column called Grade based
on the following table:

Total Marks (100%) Grade


85 – 100 A
75 – <85 A-
70 – <75 B+
65 – <70 B
60 – <65 B-
55 – <60 C+
50 – <55 C
45 – <50 D+
40 – <45 D
< 40 F

Lab4-G3
CSC3100 – PROBLEM SOLVING AND PROGRAMMING CONCEPTS SEM 2 2023/2024

3. An Internet service provider has three different subscription packages for its
customers as shown below:

Package Code Monthly Additional charges for voice


charges call per minute
P1 - 30Mbps 1 RM89 20 cents/minute
P2 - 100Mbps 2 RM129 200 minutes free voice call
Beyond: 20 cents/minute
P3 - 300Mbps 3 RM199 10 cents/minute

Based on the monthly package that has been identified, calculate, and display a
customer’s total monthly bill. Before coding, complete the pre-programming phase
(develop the PAC, IPO, flowcharts, and write the pseudocode).
Sample output:
Enter package code: 2
Enter minutes voice call: 300

The total monthly bill: RM149.00

4. The table below shows the electricity charges for domestic consumers
(households) in Malaysia.

For example, if the usage is 400kWh a month, these are the calculations:
First 200kWh [(200xRM21.80)/100] = RM43.60
Next 100kWh [(100xRM33.4)/100] = RM33.40
Next 100kWh [(100xRM51.60)/100] = RM51.60
TOTAL = RM128.60

Write a program to calculate a customer’s monthly bill based on their electricity


usage.

5. A mail-order house sells five products whose retail prices are as follows:
Product 1 = RM2.98; product 2 = RM4.50; product 3 = RM9.98; product 4 = 4.49
and product 5 = RM6.87.
Write a program that reads a pair of numbers, i.e. the product number and the
quantity sold, then calculates and displays the total retail value of the product sold.
Customers should know the product number and price before choosing the
product. Use the switch statement for the selection process.

Lab4-G3
CSC3100 – PROBLEM SOLVING AND PROGRAMMING CONCEPTS SEM 2 2023/2024

Extra Exercise

6. KMHZ bookstore is looking for employees. Applicants must be male and aged
between 18 to 30 years. If both conditions are not met, the application will be
rejected.

7. You are required to determine admission to the Form 4 science stream class
based on the PT3 examination results. The condition is that students must get 5A
and above and get an A in science and mathematics subjects or get an A in
English and mathematics subjects

8. Price of a movie ticket is based on the age of the customer. The normal price for
adults is RM7.00. If the age is below than 13 years old but greater than 3 years
old, the price is about 30% of the normal price and if below than 3 years old is
free. If the age is greater than 60 years old, the price is about 50% of the normal
price. Develop a program and display the price need to be paid by the customer.

9. A vendor company will give some discounts on its products based on the total
units bought by the customer and the price of each unit. The table shows the
discount given with the price and the total units. Write if…else statements based
on the table.

Number of Price (RM)


items bought 0.01 – 10.00 10.01 – 100.00 100.01
1-9 0% 2% 5%
10 - 99 5% 7% 9%
100 - 499 9% 15% 21%
500 – 999 14% 23% 32%
> 1000 21% 32% 43%

10. A hotel has a pricing policy as follows:


 single room: RM185/day
 double room: RM210/day
 family room: RM285/day

If the customer is government servant, there is a 10% discount. If the customer


age over 60 years old, there is a 15% discount. A customer does not receive both
discounts. Write a program that prompts the customer to enter the required data
for hotel booking and display the price of the room booking.

Lab4-G3

You might also like