13
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.

problem based task oop

Embed Size (px)

DESCRIPTION

problem based task object oriented pragramming 2012 | PSMZA |

Citation preview

Page 1: problem based task oop

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.

Page 2: problem based task oop

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.

Page 3: problem based task oop

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.

Page 4: problem based task oop

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.

Page 5: problem based task oop

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;

Page 6: problem based task oop

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());

} }

Page 7: problem based task oop

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)))

Page 8: problem based task oop

{ 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)); }

Page 9: problem based task oop

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!"); } }

Page 10: problem based task oop

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.

Page 11: problem based task oop

THE OUTPUT

Example of the output:

Page 12: problem based task oop

Another example:

Page 13: problem based task oop

THE END