Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

public class BasicInput

I’ve tried to run this code:

public class BasicInput {
   public static void main(String[] args) {
      Scanner scnr = new Scanner(System.in);
      int userInt = 0;
      double userDouble = 0.0;
      char ch;
      String s;
     
      System.out.print(“Enter integer: “);
      userInt = scnr.nextInt();
      System.out.print(“Enter double: “);
      userDouble = scnr.nextDouble();
      System.out.print(“Enter character: “);
      ch = scnr.next().charAt(0);
      System.out.print(“Enter string: “);
      s = scnr.next();
      System.out.println(userInt+” “+userDouble+” “+ch+” “+s);
      System.out.println(s+” “+ch+” “+userDouble+” “+userInt);
      System.out.println(userDouble+” cast to an integer is “+(int)userDouble);
      return;
    
   }

My values are:

Need assignment help for this question?

If you need assistance with writing your essay, we are ready to help you!

OUR PROCESS

Order

Payment

Writing

Delivery

Why Choose Us: Cost-efficiency, Plagiarism free, Money Back Guarantee, On-time Delivery, Total Сonfidentiality, 24/7 Support, 100% originality

Enter integer: 99
Enter double: 3.77
Enter character: z
Enter string: Howdy
99 3.77 z Howdy

The result I get is:

Enter integer: Exception in thread “main” java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:907)
at java.util.Scanner.next(Scanner.java:1530)
at java.util.Scanner.nextInt(Scanner.java:2160)
at java.util.Scanner.nextInt(Scanner.java:2119)
at BasicInput.main(BasicInput.java:12)

 
"Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "Newclient"