0% found this document useful (0 votes)
20 views1 page

FT-PT#2 CP

The document contains a Java program that prompts the user to enter a number between 1 and 7, corresponding to the days of the week. It uses a switch statement to print the name of the day based on the input number. If the input is outside the range, it outputs an 'Invalid Number Input' message.

Uploaded by

trialmailbynix
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views1 page

FT-PT#2 CP

The document contains a Java program that prompts the user to enter a number between 1 and 7, corresponding to the days of the week. It uses a switch statement to print the name of the day based on the input number. If the input is outside the range, it outputs an 'Invalid Number Input' message.

Uploaded by

trialmailbynix
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

YMANA, MICO A.

TVL – ICT : ALONZO


FT-PT #2
import java.util.Scanner; // in this line, here we imported the java utility which is the scanner.
// as usual, we use the java main method.

class Main { public static void


main(String[] args) {
Scanner myObj = new Scanner(System.in);

// in this line, we defined the 5 subject variable.


int day;

/*This is where we put the scanner using "myObj" with


the print line that contains the grade of the subjects.*/
System.out.println("Enter Number 1-7:");
day = myObj.nextInt();

switch (day) {
case 1:
System.out.println("Monday.");
break;
case 2:
System.out.println("Tuesday.");
break;
case 3:
System.out.println("Wednesday."); break; case 4:
System.out.println("Thursday");
break; case 5:
System.out.println("Friday");
break; case 6:
System.out.println("Saturday");
break;
case 7:
System.out.println("Sunday");
Break;
default:
System.out.println("Invalid Number Input");
break;
}
}
}

You might also like