import java.util.Scanner;
class Date{
private int date;
private int month;
private int year;
public void input(){
Scanner scan = new Scanner(System.in);
System.out.println("Enter date: ");
int d= scan.nextInt();
System.out.println("Enter month: ");
int m= scan.nextInt();
System.out.println("Enter year: ");
int y= scan.nextInt();
date = d;
month = m;
year = y;
}
String fixed(){
String s = date+"-"+month+"-"+year;
return s;
}
void output(){
System.out.println(fixed());
}
}
public class Main
{
public static void main(String[] args) {
Date d= new Date();
d.input();
d.output();
}
}
Comments
Leave a comment