Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please use very basic java code to do this so I can understand it. I'm having a hard time with when to use brackets when

image text in transcribed

please use very basic java code to do this so I can understand it. I'm having a hard time with when to use brackets when I'm doing for and while loops along with if statements.

EGR 140: Computer Programming ment# Assigned: Wednesday, 13 September 2017 Due: Monday, 18 September 2017 Points 20 Write an error-free Java program to do the following things. 1. Inputs two integers from the user. (You may input both of the integers at the same time but your best bet is to input the integers one at a time.) The limit of 2 is to simplify testing; you should write your program so that it can be easily extended to work with more than 2 numbers. 2. If the input integer is not between1 and 5000000 (non-inclusive), then keep prompting the user to re-enter the number till the integer is within the proper range. 3. Determine if the input number is prime. If N is prime, then print a message stating that it is prime. If the number is nat prime, say it is not prime and determine the smallest factor of the number (other than 1). 4. To summarize, you must read in two numbers, make sure they are within in the proper range determine if each number is prime, and, if not prime, determine its largest factor. There are many ways to do this program, but you must include at least one for loop in your program. Sample output: 0Input integer 1: 379 0Input integer 2: 5917 Input integer 1: 10000000 Your number 379 is prime * .. The smallest non-unity factor of 5917 is 61 Remember to put the usual header at the top of the program and to submit via Canvas

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Examine various types of executive compensation plans.

Answered: 1 week ago

Question

1. What is the meaning and definition of banks ?

Answered: 1 week ago

Question

2. What is the meaning and definition of Banking?

Answered: 1 week ago

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago

Question

What about leadership lessons from particularly good or bad bosses?

Answered: 1 week ago