91.2k views
2 votes
Write two 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:

User Sdayal
by
3.5k points

1 Answer

1 vote

Answer:

1/2000

Step-by-step explanation:

import java.util.Scanner;

public class InputExample {

public static void main(String [] args) {

Scanner scnr = new Scanner(System.in);

System.out.print("Enter birth month and date:");//comment this line if not needed

int birthMonth=scnr.nextInt();

int birthYear=scnr.nextInt();

String output= birthMonth+"/"+birthYear+"\\";

System.out.println(output);

}

}

if using this code the out put should be 1/2000

User Grahamaj
by
3.6k points