CSF3034 - Lab Module 3
CSF3034 - Lab Module 3
3.1 Activity 1
3.1.1 Objective
Write a Java program to calculate and display the gross pay for an hourly paid employee based on the
flowchart or pseudocode that you have designed in Lab Module 2 (Activity 1).
3.2 Activity 2
3.2.1 Objective
Suppose your cell phone calling plan allows you to use 700 minutes per month. If you use more that this limit
in a month, you are charged an overage fee of RM0.35 for each excess minute. Your phone shows you the
number of excess minutes that you have used in the current month, but it does not show you how much your
overage fee currently is. You would like to have a program that be able to enter the number of excess
minutes, and have the program perform the calculation for you. The program should be able to receive input
and display output as shown in the figure below.
*****************************************************
MY CELL PHONE OVERAGE FEE
*****************************************************
ENTER THE NUMBER OF EXCESS MINUTES: 20
OVERAGE FEE = RM 7.0
i. Modify the pseudocode/flowchart as designed in Lab Module 2 (Activity 3) according to the above
problem.
ii. Write a Java program that should be able to obtain input using Scanner class and display the output as
shown in the figure above.
[Estimate 30 minutes]
3.3 Activity 3
3.3.1 Objective
Write an application that takes Celsius temperature as input and converts it to its Fahrenheit equivalent. The
formula is:
3.4 Activity 4
3.4.1 Objective
Suppose you want to deposit a certain amount of money into a savings account, and then leave it alone to
draw interest for the next 10 years. At the end of 10 years, you would like to have RM10,000 in the account.
How much do you need to deposit today to make that happen? You can use the following formula to find
out:
𝐹
𝑃=
(1 + 𝑟)!
where
P is the present amount that you need to deposit today
F is the future value that you want in the account
r is the annual interest rate
n is the number of years that you plan to let the money sit in the account
i. Modify the pseudocode/flowchart as designed in Lab Module 2 (Activity 4) in order to perform the
calculations that can experiment with different values for the terms as depicted in the figure below.
*****************************************************
MY SAVING FORECAST PROGRAM
*****************************************************
WHAT IS THE VALUE YOU WANT TO HAVE IN YOUR ACCOUNT? RM 10000
HOW MANY YEARS YOU WANT THE MONEY TO SIT IN YOUR ACCOUNT? 10
WHAT IS THE ANNUAL INTEREST RATE (IN %)? 3.41
ii. Write a Java program that should be able to obtain input using Scanner class and display the output as
shown in the figure above.
3.5 Activity 5
3.5.1 Objective
Body Mass Index (BMI) is a measure of health on weight. It can be calculated by taking your weight in
kilograms and dividing by the square of your height in meters.
3.6 Activity 6
3.6.1 Objective
The total price of a product is the price of the product plus the sales tax. Suppose the sales tax is 6%. Write
a program that reads the price of the product and displays the total cost of the product.