Answer:
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Scanner;
public class Main {
private static final DateFormat dateformat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
private static final DateTimeFormatter datetimeformat = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
public static void main(String[] args) {
System.out.println("Enter your ID and Name");
LocalDateTime current = LocalDateTime.now();
Scanner sc1 = new Scanner(System.in);
String Name= sc1.nextLine();
int ID = sc1.nextInt();
System.out.println(Name + "reported at:");
System.out.println(datetimeformat.format(current));
}
}
Explanation:
The above program saves the current date-time as well, at the time when the user enters his name and ID. And it prints the same on the screen. Further, you can store these in a data structure like list or class or you can store it in a database as well. Remember, this is the difference between a program and a web application, and not to forget we have a toolkit in case of the web application. And here we are working on the console. Also, a web application has a front panel and back panel. However, a program only solves a computing problem, and there is no well-designed interface with the user. However, programming is the root of all other programmings like web programming, mobile app programming, etc.