=================
CAR PARK SYSTEM
===FROM======
Insert Day :
Insert Month :
Insert Year :
Insert Hour :
Insert Minute :
=====TO======
Insert Day :
Insert Month :
Insert Year :
Insert Hour :
Insert Minute :
=================
FROM 9/8/2012 8.00 TO 10/8/2012 3.00
TOTAL PARKING TIME >> 1 DAY 8HOURS
TOTAL PAY >> RM36
This is my coding, so far i only done coding for day,month and year.i want to know if the coding is right or wrong because i think something wrong.so far the coding that i search in the internet is mostly about current date and for user to insert date is hard to find. anyone can help.
import java.util.*;
import java.text.*;
class CarPark{
public static void main(String[] args){
Scanner input=new Scanner(System.in);
System.out.print("\nEnter Day(1-31): ");
int dd=input.nextInt();
System.out.print("Enter Month(1-12): ");
int month=input.nextInt()-1;
System.out.print("Enter Year: ");
int year=input.nextInt();
System.out.println("From : "+dd+"/"+(month+1)+"/"+year);
}
}
This post has been edited by Atli: 09 October 2012 - 01:09 AM
Reason for edit:: Please use [code] tags when posting code.

New Topic/Question
Reply



MultiQuote




|