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
A _______ is used to present data in a simplified, graphical format that allows your audience to read less text while still bein
steposvetlana [31]
Your correct answer would be Legend.


answer choice is B.
3 0
4 years ago
Read 2 more answers
For whom is beneficial to deduct the amount paid in state income tax from their income for purposes of computing federal income
Musya8 [376]

Obvious advantages stem from being able to deduct the full cost of state and local taxes you have to pay each year. Every deduction from taxable income helps, and these taxes can sometimes be significant. It's something of a double hit if you have to pay taxes to your state and also pay federal tax on taxes you paid to your state.

The state and local tax deduction (SALT) prevents that from happening, at least to some extent.

Rules for the SALT Deduction

All income taxes that are imposed by a state, local, or foreign jurisdiction can be deducted subject to a few rules.

First, you must itemize your deductions on Schedule A to claim them. This means foregoing the standard deduction, which is often more than the total of a taxpayer's itemized deductions for the tax year. Don't be penny wise and pound foolish and give the Internal Revenue Service more money than you have to. Make sure your total itemized deductions exceed the standard deduction for your filing status so itemizing is worth your while. Otherwise, you'll be paying taxes on more income than you have to, which was what you were trying to avoid in the first place.

The tax must be imposed on you personally. You can't claim a deduction for income taxes paid by one of your dependents—and in some cases, even by your spouse. You must have paid them during the tax year for which you're filing.  

Eligible expenses that can be deducted as state and local income taxes include:

Withholding for state and local income taxes as shown on Form W-2 or Form 1099

Estimated tax payments you made during the year

Extension tax payments you made during the year

Payments made during the year for taxes that arose in a previous year

Mandatory contributions to state benefit funds

8 0
3 years ago
Which statement will remove 5:'softball' from the dictionary?
dimaraw [331]

Answer:

sports.pop(5)

Explanation:

edg 2020

4 0
3 years ago
Read 2 more answers
1. Jaina is a big fan of a popular comic book series, and is so inspired that she decides to write her own story. She starts her
dolphi86 [110]

Answer:

copyright infringement

Explanation:

4 0
4 years ago
Jason Diaz is a financial advisor who works in an open office with coworkers nearby. Jason advises clients both in person and ov
Elanso [62]

Answer:

There is a need for a microphone and a speaker in the form of a headset for privacy, also, the conventional keyboard and monitor screen. For information security, a configured firewall is recommended to prevent hacking.

Explanation:

Input and output devices are tools used by an operator of a computer device to give instructions and monitor results respectively.

Jason would need a headset, which has a speaker for hearing and a microphone for speaking to the client on a video conference call. These I/O devices are readily available on some personal computers. Every computer system has a keyboard and a monitor, this is also useful for Jason for communicating with his client.

7 0
3 years ago
Other questions:
  • Which of the following documents specifies the uptime guarantee of a web server?A. Due processB. Due diligenceC. Scope of workD.
    7·1 answer
  • You recently set up a DHCP server and need to configure your computer to start using it. Click the IPv4 properties option that y
    10·1 answer
  • OSHA requires training for employees on the hazards to which they will be exposed.
    12·2 answers
  • The next thing Maia wants to do is to indent the first line of her paragraphs.
    15·2 answers
  • [c++] Write a recursive function takes a word string as input argument and reverse the word. Print out the results of recursive
    14·1 answer
  • Are scripted languages easier or more difficult to port than programming languages? Why?
    6·1 answer
  • In order to view the permissions assigned to each type of user for all the files located in a directory, which of the following
    12·1 answer
  • Which of the four digital-to-analog conversion techniques is the most susceptible to noise? EXPLAIN WHY.
    6·1 answer
  • What do customers use to access the internet, usually for a monthly fee?
    6·1 answer
  • Write a function header for the ZooAnimal class member function daysSinceLastWeighed. This function has a single integer paramet
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!