COMPROG: Computer Fundamentals and Programming Laboratory Activity 03
So far, you are already familiar with the following:
Opening and editing an existing Java file using the JCreator IDE
Compiling and running (executing) a Java program
Using the Java Tutorials and the API Documentation
Basic elements of the Java language
Basic use of input, output, assignment statements in Java
Basic Java operators
Read the problem statements below and create the Java programs required.
1. Problem Statement:
Create a program that will compute the savings for the week by providing data regarding the weekly allowance
and the average daily expenses. The average daily expenses (for 6 days) to be considered are
the following: Transportation, Food, and Load (Cell phone).
Filename: Saving.java
Below are sample outputs of the program execution. Note that red marked values are the ones entered from
keyboard while blue marked values are generated by the program.
Weekly allowance: 600 Weekly allowance: 500
Average Daily Expenses: Average Daily Expenses:
Transportation: 12 Transportation: 24
Food: 70 Food: 30
Load (Cell Phone): 10 Load (Cell Phone): 20
Total Expenses for the week: 552.00 Total Expenses for the week: 444.00
Saving for the week: 48.00 Saving for the week: 56.00
IMPORTANT!!!
In order to create a new Java program, choose File from the JCreator menu, choose New -> File .
The File Wizard should have the default option Java Classes. Click Next , type the filename as
specified in the problem, and browse through drive D: to select your folder as the location for your
file. The programs you create will be saved to this location. Note that in order for your program
to compile and run properly, your folder should contain the file Keyboard.java .
Load previous programs ( Cellphone.java and/or Numbers.java ) to serve as a guide in the creation
of your programs.
2. Problem Statement:
Write a program that accepts the amount purchased (which must be less than P100.00) by a customer and
computes for the change if the money given by the customer is P100.00. All purchases must be in pesos with no
centavos. The change must be shown with the following breakdown: P50.00, P20.00, P10.00, P5.00, and P1.00.
Filename: Purchase.java
Below are sample outputs of the program execution:
Amount Purchased: 36 Amount Purchased: 73
Change of customer is 64. Change of customer is 27.
Change breakdown: Change breakdown:
P50.00 1 P50.00 0
P20.00 0 P20.00 1
P10.00 1 P10.00 0
P5.00 0 P5.00 1
P1.00 4 P1.00 2
Hint: Use modulo division.