Upload
farhanum-aziera
View
997
Download
5
Embed Size (px)
DESCRIPTION
problem based task object oriented pragramming 2012 | PSMZA |
Citation preview
INTRODUCTION
We are assigned with a Problem Based Task in topic system payment for a parking meter.
We have to create a system that accept an input from user and give out the output for them.
OBJECTIVE
One of our objective is to make an easier way for a user to use a parking system.
We provide the great way for parking payment and give special offer for member and our loyal customer.
SCOPE
The system that we have build is consist of the use of control statements.
As example, we used looping statement which is used to make our system loop again and again without fail.
Despite that, we also use selection statement (if-else) to provide the user with a better choice.
HOW TO USE THE PROGRAM
By just key in the time you’ve enter and exit, our program will calculate it for you.
No more wasting time like when we using in manual way.
After the amount of payment appear on the screen, you can make the payment directly.
EXAMPLE OF CODING
import java.io.*;
public class Park { public static void main(String args[]) throws Exception { BufferedReader axm = new BufferedReader(new
InputStreamReader(System.in)) ;
int x; int y; int b;
for(int i=0;i<50;i++) { System.out.println("This parking system is based
on 24 hours "); System.out.println("Please key in your choices in
format 24 hours"); System.out.println("Check in :"); x = Integer.parseInt(axm.readLine()); System.out.println("Check out :"); y = Integer.parseInt(axm.readLine());
} }
System.out.println("1) Non-Member 2) Member\n"); System.out.println("Your choice:"); int a= Integer.parseInt(axm.readLine()); b=y-x;
if ((a == 1) && ((x>=1) && (x<12)))
{ System.out.println("You need to pay RM" +
(b*2.00)); } else if ((a == 2) && ((x>=1)&&
(x<12))) { System.out.println("You need to pay RM" +
(b*1.50)); }
else if ((a == 1) && (x>=12))
{ System.out.println("You need to pay RM" + (b*2.00-0.10)); } else if ((a == 2) && (x>=12)) { System.out.println("You need to pay RM" + (b*1.50-
0.10));› }
else { System.out.println("Invalid Entry!"); } }
EXAMPLE OF DATA
For an example, data that we key in is check in at 4 in the morning and check out at 5 in the evening.
Our system will calculate the payment that will be paid by the customer.
The system then will loop and waiting for another user.
THE OUTPUT
Example of the output:
Another example:
THE END