1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
victus00 [196]
3 years ago
10

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
Computers and Technology
1 answer:
Alexus [3.1K]3 years ago
4 0

Answer:

The java program fulfilling all the requirements is given below.

import java.util.Scanner;

public class BirthDate {

   

   // variable to hold month

   static int birthMonth;

   

   // variable to hold month

   static int birthYear;

   

   public static void main(String args[]) {

   

   // object of Scanner created to enable user input  

     Scanner scnr = new Scanner(System.in);

     

     // user input taken for month of birth

     System.out.println("Enter the month of birth ");

     birthMonth = scnr.nextInt();

     

     // user input taken for year of birth

     System.out.println("Enter the year of birth ");

     birthYear = scnr.nextInt();

     

     // birth date is displayed in the mentioned format

     System.out.print("The birth date is " + birthMonth + "/" + birthYear);

     

     // ending with newline

     System.out.println("");

   }

}

OUTPUT

Enter the month of birth  

1

Enter the year of birth  

2000

The birth date is 1/2000

Enter the month of birth  

5

Enter the year of birth  

1950

The birth date is 5/1950

Explanation:

The above program is described below.

1 – The variables are declared static since they are used in main() method which is static. Both variables are declared integers as per the question.

2 – Program begins with taking user input for month of the birth followed by year of the birth.

3 – The user input is taken separately for both variables using scanner object, scnr, as per the question requirement.

4 – The birth date is displayed to the console output in the format mentioned in the question: month / year, month of birth followed by slash followed by year of birth. The display statement is written as System.out.print("").

5 – The program is tested using the set of values given in the question.

6 – The input for month and year is not tested for validity since this is not mentioned in the question.

7 – The program ends with newline given by System.out.println("").

8 – print() method displays the output. The println() displays output and inserts a new line after the output.

You might be interested in
What is output by the following code? for x in range(7, 16): print(x * 2, end=" ") Group of answer choices 14 16 18 20 22 24 26
madreJ [45]

Input:-

\tt for\:x\:in\:range(7,16):

\tt print(x*2,end"")

Output:-

\tt 14,16,18,22,24,26,28,30,32

The loop will start from 7×2=14 to 16×2=32

8 0
3 years ago
What does modulate your voice mean
alexandr1967 [171]
To modulate your voice is to modify or gain more control of your voice. It basically means to change or adjust the pitch or tone.
7 0
4 years ago
Read 2 more answers
How will you configure those computer hardware peripherals​
almond37 [142]

Answer:

i dont

Explanation:

know sorry tenks thankyou

8 0
3 years ago
What is Logic and Emotion?
m_a_m_a [10]
Logic is Strict principles of validity (reasoning)

Emotion is the natrual instinctive feeling from reasoning or knowledge.

Hope this helps! ^0^ <span />
8 0
3 years ago
Read 2 more answers
In the formula =SUM(A6:A9), which of the following best describes A6:A9
lianna [129]

Arguments are indeed the values used by <em>functions to perform computations</em>, and the further discussion can be defined as follows:

  • <em>Functions</em> in spreadsheet programs including Excel Sheets are simply built-in formulas that perform predefined calculations.
  • In this, the majority of these functions require data to be supplied, either by the user or from another source, to deliver a result.
  • It is a real value that is provided to the function, as well as the parameters, are initialized to the value of the arguments supplied.
  • In this question, a method "SUM(A6:A9)" is declared that takes value from A6 to A9, in its parameter(Argument) that <em>adds value from</em>.  

Therefore, the final answer is "Option A".

Learn more:

brainly.com/question/12269471

6 0
3 years ago
Read 2 more answers
Other questions:
  • Which javascript method should you use if you want to specify a message string to appear on your web page as it loads?
    13·1 answer
  • In the ____, or ad hoc, layouts configuration, there is no access point at the center of a cell.
    7·1 answer
  • Help me please and thanks
    8·1 answer
  • Which of these consoles have 64 bit architecture
    13·1 answer
  • A user from the accounting department has contacted you regarding problems with a dot matrix printer. When you examine the outpu
    7·1 answer
  • Rather than simply repeating key terms and concepts, Jeremy focused on the meaning of the information in the chapter and tried t
    13·1 answer
  • Being nice take the points​
    9·1 answer
  • What happens to the files and folders on the desktop when the computer is turn off
    7·1 answer
  • Unscramble the risks of sharing files on the Intern
    15·1 answer
  • Is doing free lancing from age 16 good or bad?​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!