Write two scnr.nextInt statements to get input values into birthMonth and birthYear. Then write a statement to output the month, a slash, and the year. End with newline. The program will be tested with inputs 1 2000, and then with inputs 5 1950. Ex: If the input is 1 2000, the output is: 1/2000 Note: The input values come from user input, so be sure to use scnr.nextInt statements, as in birthMonth = scnr.nextInt();, to get those input values (and don't assign values directly as in birthMonth = 1).

Respuesta :

Answer:

// here is code in java.

import java.util.*;

// class definition

class Solution

{

// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // scanner object to read the input from user

       Scanner s=new Scanner(System.in);

       System.out.println("Please enter the month:");

        // read the month from user

       int birthMonth=s.nextInt();

       System.out.println("Please enter the year:");

        // read the year from user

       int birthYear=s.nextInt();

        // print the output

       System.out.println(birthMonth+"/"+birthYear);

       

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read the value of month and year from user with the help of scanner object and assign them to variables. then print the month and year separated by a slash "/".

Output:

Please enter the month:1

Please enter the year:2000

1/2000