I need help on approaching this coding problem. Thanks. Write two scnr.nextint s
ID: 3906521 • Letter: I
Question
I need help on approaching this coding problem. Thanks.
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 51950. Ex If the input is 1 2000, the output is: 1/28e0 Note: The input values come from user input so be sure to use scnr nextInt statements, as in birthlonth = to get those input values (and don't assign values directly as in birthMonth -1). scnr. next Int(); 1 import java.util.scanner 3 public class InputExample ( public static void main(String[ args) ( Scanner scnr - new Scanner (Syston.in); int birthMionth; int birthYear: 1e Systen.aut.println("1/28e* /* Your solution goes here */ 13 14. Run Testing with user input 1 2000 Your output 1/2000 X Testing with user input 5 1950 Output differs. See highlights below. /200 Expected output /1950Explanation / Answer
import java.util.Scanner; public class InputExample { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int birthMonth; int birthYear; birthMonth = scnr.nextInt(); birthYear = scnr.nextInt(); System.out.println(birthMonth + "/" + birthYear); } }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.