Respuesta :
Answer:
Since you are not mentioning the programming language. We are using C++ to complete the above program.
Explanation:
PROGRAM:
//Declare the header file
#include <iostream>
//Declare the namespace
using namespace std;
//Define the main funcion
int main()
{
//Declare the variable to hold the month of birth
int birthMonth;
//Declare the variable to hold the year of birth
int birthYear;
//Print the string
cout<<" Enter birth month and birth year separated by space"<<endl;
//Get the value of month from the user
cin >> birthMonth;
//Get the value of year from the user
cin >> birthYear;
//Print he value of month
cout << birthMonth;
//Printing the slash
cout<<"/";
//Print the year
cout << birthYear;
//Return "0"
return 0;
}
Answer:
// Scanner class is imported
import java.util.Scanner;
// InputExample class to hold the program
public class InputExample {
// main method to begin program execution
public static void main(String args[]) {
// Scanner object scnr is created
Scanner scnr = new Scanner(System.in);
// variable birthMonth is declared
int birthMonth;
// variable birthYear is declared
int birthYear;
// birthMonth is initialized to 1
birthMonth = 1;
// birthYear is initialized to 2000
birthYear = 2000;
// birthday is displayed
System.out.println("1/2000");
// prompt is displayed asking user to enter birthMonth
System.out.println("Enter birthMonth:");
// birthMonth is received using Scanner object
birthMonth = scnr.nextInt();
// prompt is displayed asking user to enter birthYear
System.out.println("Enter birthYear:");
// birthYear is received using Scanner object
birthYear = scnr.nextInt();
// the birthday format is displayed
System.out.println(birthMonth + "/" + birthYear);
}
}
Explanation:
The program is written in Java as required and it is well commented.
An image depicting the full question is attached.