Write a program using integers userNum and x as input, andoutput userNum divided by x four times.

Ex: If the input is 2000 2, the output is:

1000 500 250 125

Note: In Java, integer division discards fractions. Ex: 6 / 4 is1 (the 0.5 is discarded).

*I can’t figure out how to get the code to read the next ticketand when i try to assign a variable as an integer, it gives me theerrors below*

*
*

LabProgram.java Load default template… 3 public class LabProgram f public static void main(String<> args) t Scanner scnr new Scanner(System.in); int use rNum = scnr.nextInt(); int x scnr.nextIntO 7 System.out.printuserNum/x+”); System.out.print(userNum / (2*x) +” System.out.print(userNum (4*x) +””); System.out.println(userNum/ (8*x)) userNum scnr.nextIntO; int y= scnr.nextint(); System.out.print(userNum/ y); Type your code here. * 10 12 13 14 15 16 17 18 19 Output differs. See highlights below. Special character legend Input 2000 2 1000 500 250 125 Exception in thread “main” java.util.NoSuchElementException+ Hat java.base/java.util.Scanner.throwFor (Scanner.java: 937) Your output at java.base/java.util.Scanner.next (Scanner.java: 1594) at java.base/java.util.Scanner.nextInt (Scanner.java:2258) -at java.base/java.util.Scanner.nextInt (Scanner.java:2212) lat LabProgram.main (LabProgram.java: 13) Expected output 1000 500 250 125 2: Compare output 0/3 Output differs. See highlights below. Special character legend nput 1004 25 12 6 3 Exception in thread “main” java.util.NoSuchElementException lat →lat lat java.base/java.util.Scanner.throwFor (Scanner.java: 937) java.base/java.util.scanner.next (Scanner.javas 1 594) java.base/java.util.Scanner.nextInt (Scanner.java:2258) Your output Show transcribed image text LabProgram.java Load default template… 3 public class LabProgram f public static void main(String<> args) t Scanner scnr new Scanner(System.in); int use rNum = scnr.nextInt(); int x scnr.nextIntO 7 System.out.printuserNum/x+”); System.out.print(userNum / (2*x) +” System.out.print(userNum (4*x) +””); System.out.println(userNum/ (8*x)) userNum scnr.nextIntO; int y= scnr.nextint(); System.out.print(userNum/ y); Type your code here. * 10 12 13 14 15 16 17 18 19 Output differs. See highlights below. Special character legend Input 2000 2 1000 500 250 125 Exception in thread “main” java.util.NoSuchElementException+ Hat java.base/java.util.Scanner.throwFor (Scanner.java: 937) Your output at java.base/java.util.Scanner.next (Scanner.java: 1594) at java.base/java.util.Scanner.nextInt (Scanner.java:2258) -at java.base/java.util.Scanner.nextInt (Scanner.java:2212) lat LabProgram.main (LabProgram.java: 13) Expected output 1000 500 250 125 2: Compare output 0/3 Output differs. See highlights below. Special character legend nput 1004 25 12 6 3 Exception in thread “main” java.util.NoSuchElementException lat →lat lat java.base/java.util.Scanner.throwFor (Scanner.java: 937) java.base/java.util.scanner.next (Scanner.javas 1 594) java.base/java.util.Scanner.nextInt (Scanner.java:2258) Your output

Expert Answer

Answer to Write a program using integers userNum and x as input, and output userNum divided by x four times. Ex: If the input is 2…




You are watching: Write a program using integers usernum and x as input, and output usernum divided by x four times.

(Solved) : Write Program Using Integers Usernum X Input Output Usernum Divided X Four Times Ex Input Q34421882(1) . .

See more: A Tree Grows In Brooklyn Pdf Download, A Tree Grows In Brooklyn Pdf

. quantity