CHALLENGE 1.24: Read multiple user inputs. ACTIVITY 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 senr.nextInt()i, to get those input values (and don't assign values directly as in birthMonth - 1). 1 import java.util.Scanner; 3 public class InputExample 4 public static void main(String 5 args) scanner scnr = new Scanner(System.in); int birthMonth; int birthYear; Al pa 7 /* Your solution goes here 10 12

Question
CHALLENGE 1.24: Read multiple user inputs.
ACTIVITY
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 senr.nextInt()i, to get those input values (and don't assign values directly as in birthMonth - 1).
1 import java.util.Scanner;
3 public class InputExample
4 public static void main(String
5
args)
scanner scnr = new Scanner(System.in);
int birthMonth;
int birthYear;
Al
pa
7
/* Your solution goes here
10
12
Expand
Transcribed Image Text

CHALLENGE 1.24: Read multiple user inputs. ACTIVITY 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 senr.nextInt()i, to get those input values (and don't assign values directly as in birthMonth - 1). 1 import java.util.Scanner; 3 public class InputExample 4 public static void main(String 5 args) scanner scnr = new Scanner(System.in); int birthMonth; int birthYear; Al pa 7 /* Your solution goes here 10 12

Expert Answer

1 Rating

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: You are not required to execute the queries. However, your syntax must by accurate.You must give at ...

A: Answer for 11: SELECT MIN(MEM_BALANCE) AS MINIMUM_BALANCE, MAX(MEM_BALANCE) AS MAXIMUM_BALANCE, AVG(...

Q: create a python program that will ask users to input four different manufacturers of cars(e.g Ford, ...

A: Create a class Car and define _init_ () function which will initialize the value of variables manufa...

Q: I am trying to write a program to convert a number from an integer to an octal. How do I do this wit...

A: As there is no particular programming language mentioned, we are doing this conversion of integer nu...

Q: Try giving these 2 commands $ echo cat$ cat echoExplain the differences between the output of each c...

A: echo command:echo command is used to display the line of text passed as an argument. It is a built i...

Q: Create a new file in c++ and save it as lab11_XYZ.cpp (replace XYZ with your initials). Create ANOTH...

A: Program Instructions:In the header file, create a temporary variable temp of the data type of each v...

Q: For this program you need to use Eclipse. Carefully read the instructions and write a program that r...

A: The program has the following algorithm: Step 1: Create object for “Scanner” class to read the user ...

Q: Not very familiar with RAID so I would really appreciate some help and an explanation behind the ans...

A: RAID is an acronym for Redundant Array of Independent Disk. It is a process of storing the data into...

Q: Visual Basic. Given two variables, isEmpty of type boolean, indicating whether a class roster is emp...

A: We have to check two conditions:-1) class roster is not empty 2) The class has more than two credits...

Q: Use Eclipse for do this program. Show the output of the following statements.a) System.out.printf("a...

A: The program has the following algorithm:a) The statement print the amount in floating point and expo...

Q: Develop the ‘Shape’ application such that: ‘Rectangle’, ‘Ellipse’, and ‘Triangle’ classes inherit f...

A: Program plan:Define a class named “Shape”.Define a default constructor to print constructor invoked ...

Q: Help.

A: The given program is defining the function swapints with two integer values. The swapints function i...

Q: Assume the following declarations and initializations (MIN, MAX, num) are made just before each sub-...

A: Hey, since there are multiple questions posted, we will answer first question. If you want any speci...

Q: Write a method that sums all the numbers in the major diagonal in an n x n matrix of double values u...

A: Note: The below program has been complied and executed in NetBeans IDE 8.2

Q: Do you think technologies like Big Data and Predictive Analytics in Marketing would have worked 10-1...

A: The technologies like Big Data would not have worked 10-15 years back as due to lack of large datase...

Q: Problem: Create a base class called Vehicle that has the manufacturer’s name (typeString), number of...

A: Program plan:Create a class called “Person” with required constructors and methods.Create a class ca...

Q: Read in 5 numbers from the keyboard and, if any of the entered numbers is < 0, then print out “Ne...

A: Pseudo code is given below to read five numbers from the keyboard and print “Negative” if the number...

Q: I am stuck trying to create a program in PYTHON that calculates the coins needed to make change for ...

A: We know penny=1 cent, nickel=5 cents, dime=10 cents and quarter=25 cents.Now for example if we have ...

Q: Give regular expressions for the following languages. (a) L1 = {anbm, n ≥ 3, m ≤ 4} (b) L2 = {anbm :...

A: Answer:Regular expression:a. L = {an bm, n >=3, m <= 4}

Q: Programming in C

A: Note: The given C program has been compiled and executed in "repl.it" online complier.

Q: Write a method that accepts a String as an argument and returns an int array. Assume that the string...

A: Program plan:Import the necessary header files.Define the class “Conversion”.Define the method “smal...

Q: Hi,please I need to use Python for the following: Use for loop to do the following: 1) print the num...

A: Program instructions:Use range() in for loop to print the numbers.Function range() has here argument...

Q: For this program you need to use Eclipse

A: Program plan:Declare the integer variables “coin” and “guess” and string variable “num”.Generate the...

Q: write a program in c++. You work for a box company, and have been asked to write a program to compar...

A: Click to see the answer

Q: Find context-free grammars for the following languages (with n ≥ 0, m ≥ 0)  L = {anbm : n = m − 1}.

A: Solution:A context-free grammar (CFG) is a hard and fast of recursive rewriting guidelines which is ...

Q: Attached Files:  getRandomLib.h: // This library provides a few helpful functions to return rand...

A: Program Instructions:Include the necessary header files.Print hello message and as for a response.De...

Q: Show that the following grammar is ambiguous: S → aSbS |bSaS| λ.

A: Solution:Given that,Proof: Given grammar is ambiguous.

Q: What is the most important thing to help with introduction to computers?

A: The most important thing in introduction to computers are,Hardware andSoftware

Q: Create a program that will input the 3 game scores of a player and then output the level of the play...

A: Since there are no messages given in the question for the condition where the weighted average falls...

Q: Why does Pinterest view Google as its primary competitor? Why does Pinterest focus on the smartphone...

A: Pinterest is a social media platform whose software system is designed to find and curate informatio...

Q: 11.9: Speakers' Bureau Write a program that keeps track of a speaker's bureau. The program should us...

A: We use C++ language and validate input for fees so that only integers are accepted. A struct data st...

Q: 4-20) (Process a string) Write a program that prompts the user to enter a string and displays its le...

A: Program to enter string by the user to displays string length and its first character. as in the giv...

Q: Hence the grammar:         G: ({S, A, B}, {a, b}, S, { S →bbAbabB,  A → aA|B| λ  , B → bB|A| λ}) Dra...

A: Derive the string bbaababaa with the given grammar using either leftmost or right most derivation.De...

Q: I am trying to convert a number to hexadecimal. How do I do this without using modulus, division, an...

A: To convert a decimal number into hexadecimal form with out using any of modulus, division or multipl...

Q: Fill in the following table to show how the given integers are represented, assuming that 16 bits ar...

A: Convert the integer value to binary:For positive integer:Divide the integer number by 2. The integer...

Q: 5-1) (Count positive and negative numbers and compute the average of numbers) Write a program that r...

A: Java program to count posive and negative numbers and computing the total and average of numbers is ...

Q: Construct an unambiguous grammar equivalent to the grammar in  S→AB|aaaB, A→a|Aa, B→b.

A: Solution: Construct an unambiguous grammar to grammar.Given that,S -> AB|aaaBA -> a|AaB -> ...

Q: import java.util.*;public class TestAverage {public static void main(String[] args) {int test1, test...

A: Click to see the answer

Q: SQL (Oracle) How do I create a unique constraint to find a specific price range? i.e. between 30 - 1...

A: Query to create tabale:Let us assume the table name as "Product". CREATE TABLE PRODUCT(ORDER_ID INT,...

Q: 3. Which command can you use to look for the file names status.report? Which command can you use to ...

A: The command used to look for files is ‘find’ command. Find command can be used with many criteria to...

Q: Transform the grammar with productions S → baAB, A → bAB|λ, B → BAa |A| λ into Chomsky normal form.

A: A context free grammar is in Chomsky normal form if its productions are in the formA → a or A → BC o...

Q: health informatics

A:  I think the student wants to know what health informatics is, so we will be providing a brief intro...

Q: I have a question about blockchain technologies. The question states "Describe three components of b...

A: Solution:Blockchain technologies:Blockchain is a technology which permits the digital data to be dis...

Q: Assume the following declarations and initializations (MIN, MAX, num) are made just before each sub-...

A: Since these are separate blocks of code, for the purpose of demonstration we put the blocks in same ...

Q: Design a Turing machine that computes the function f (x) = x − 2 if x > 2   = 0 i...

A: Click to see the answer

Q: A Maze Room : In this lab, we will make a maze game. The maze is based on Linked Lists. Instead of h...

A: For class Room, implement the setter and getter methods by assign and returning values respectively....

Q: Find context-free grammars for the following language: L = anbn, n is even.

A: Context-free grammar (CFG): This grammar containing predictable set of grammar rules which contains ...

Q: Construct npda that accept the following regular language: L1 = L (aaa∗bab).

A: Non-deterministic pushdown automaton (NPDA):Given: aaa*bab To construct NPDA, when “a” comes then pu...

Q: I am trying ro create this java program , i have the table in my tatabase . I am using postgresql ii...

A: Program Instructions:Add the postgresql jar file in your project library.Create a database and a tab...

Q: What language is accepted by the npda M = ({q0, q1, q2}, {a, b}, {a, b, z}} q0, z, {q2}). δ(q0,a,z)=...

A: The given npda is M = ({q0, q1, q2}, {a, b}, {a, b, z}} q0, z, {q2}) with transition functions asδ(q...

Q: Using Math.max and/or Math.min, write a class MaxOrMin, and make sure touse Math.max and Math.min wh...

A: Java codeimport java.util.Scanner; public class MaxOrMin {public static void main(String[] args){Sca...