Write a Java program that prompts the user to enter thier gender ( Female/ male) and day of the week ( Monday to Sunday). If you enter Monday, or Tuesday, or Wednesday or Thursday it should read "Hello sir, enjoy your day" or "Hello mam enjoy your day". But when entered Friday, or Saturday, or Sunday it should read "Hello sir enjoy your weekend" or "Hello mam enjoy your weekend "
import java.util.*;
public class Test {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
String gender;
String day;
System.out.print("Enter your gender: ");
gender = scan.nextLine();
System.out.print("Enter day of the week: ");
day = scan.nextLine();
if (day.equals("Monday") || day.equals("Tuesday") || day.equals("Wednesday") || day.equals("Thursday")){
if (gender.equals("male") || gender.equals("Male")){
System.out.println("Hello sir, enjoy your day");
}
if (gender.equals("female") || gender.equals("Female")) {
System.out.println("Hello mam enjoy your day");
}
}
if (day.equals("Friday") || day.equals("Saturday") || day.equals("Sunday")){
if (gender.equals("male") || gender.equals("Male")){
System.out.println("Hello sir enjoy your weekend");
}
if (gender.equals("female") || gender.equals("Female")) {
System.out.println("Hello mam enjoy your weekend");
}
}
}
}
Comments
Leave a comment