Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.time.LocalDate;
- import java.time.format.DateTimeFormatter;
- import java.util.Scanner;
- public class TimeForParty {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
- LocalDate date = LocalDate.parse(scanner.nextLine(),formatter);
- String tempDate = date.getDayOfWeek().name();
- String date1 = tempDate.substring(0, 1) + tempDate.substring(1).toLowerCase();
- String prefix;
- if ("Friday".equals(date1) || "Saturday".equals(date1)){
- prefix = "Party ";
- }else{
- prefix = "No party to";
- }
- System.out.println(prefix + "night! Today is: " + date1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement