USING JAVA (netbeans) In your main, ask the user for an int. Do this by first...

60.1K

Verified Solution

Question

Programming

USING JAVA (netbeans)

In your main, ask the user for an int. Do this by first printinga request for the int, then creating an int x, and using theScanner to read an int from the user and put it in x, likethis:

int x = scan.nextInt();

☑ Next read in two doubles d1 and d2 from the user. This willlook a lot like what you did for the int, but the scanner readsdoubles using

scan.nextDouble();

☑ Next read in a string s from the user. Scanner reads stringsusing

scan.next();

Part B

☑ if x is below 12, double it, otherwise halve it; either wayprint the result.

☑ if s is \"Hello\" print \"Hi there!\" otherwise print \"No hello?RUDE!\"

☑ if d1 and d2 are the same, print \"same\" otherwise printwhichever of d1 or d2 is higher, with the word \"MAX:\" in front ofit

Answer & Explanation Solved by verified expert
4.5 Ratings (869 Votes)
CODE package sampleimport javautilScannerpublic class Sample public static void mainString args Scanner scan new ScannerSysteminSystemoutprintEnter an integer    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students