Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question: Today you are commissioned to create a Java program that will prompt for and read three integers n1, n2 and n3 entered by the
Question: Today you are commissioned to create a Java program that will prompt for and read three integers n1, n2 and n3 entered by the user, and determine the properties of the three numbers according to the specifications that follow. Note that one set of user input may belong to more than one category. Be sure to use the same format and wording as in the sample runs in the tables below. Using a series of compound if statements (no if/else or nested if required or needed) determine which condition(s) the 3 integer numbers satisfy. 1. If all the numbers are divisible by 3 (e.g., n1 % 3 == 0), display "All the numbers are divisible by 3!". 2. If any of the numbers is divisible by 5 (e.g., n1% 5 == 0), display "At least one number is divisible by 5!". 3. If the sum of the three numbers is divisible by 3 and 5, display "The sum of the three numbers is divisible by both 3 and 5!". 4. Finish off with the message "Finished!". The box below illustrates how your program should behave and appear. REMEMBER in the output: is a space and is a new line. Text in green is user input Waiting for three integer numbers: 60-50-40 At least one number is divisible by 5! The sum of the three numbers is divisible-by-both-3-and-5! Finished! Waiting for three integer numbers: 03-3.3.1 All the numbers are divisible-by-3! Finished! Waiting for three integer numbers: 12-3. Finished! Note 1: You are to expect a perfect user who will always enter three non-negative integers; that is, do not verify the validity of user input. Note 2: All calculations, inputs and outputs should be in integer format and the use of libraries other than java.util.Scanner is prohibited. Your program must work for any double values entered, not just the ones in the samples above. Note 3: Final thought, remember that your solution is case-sensitive and space-sensitive, fulfill the above instructions carefully and precisely
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started