Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ab5.pdf (99.2 KB) + Page of 2 ZOOM is an odd prime number or not. The function that you will write will return true if
ab5.pdf (99.2 KB) + Page of 2 ZOOM is an odd prime number or not. The function that you will write will return true if the value passed as a parameter to the function is a prime number. Otherwise it will return false. 1.2 Lab Objectives The source code file Lab5.java that you will create in this section, is what you will upload as your submission file to Canvas by the due date for this lab. Please ensure that the source code rims on your machine and produces the correct output as required. Overall Objective: For this lab, we will write a JAVA program that accepts two integer values from the user and checks if they are odd Prime numbers or not. Your program must output whether each user input is an odd Prime number or not. For this section, you will create a new project in your IDE called Lab5 and create a source file called Lab5.java inside that project. The following requirements must be met to successfully complete this section Obj.1 [(2+6+2) point) Define a static boolean function called isPrime(int num) that returns true if the parameter num is Prime or false if it is not Prime. Obj.2 [2 point] Define the main() function and create an object of the Scanner class to facilitate user input. Obj.3 [2 point] Declare and define two variables of datatype int to hold the user input integers values. Obj.4 [3 point] Using the if statement and the isPrimel...) function, determine and display if the first number entered by the user is an odd Prime number or not. Obj.5 [3 point) Using the if statement and the isPrime(...) function, determine and display if the second number entered by the user is an odd Prime number or not Note here that a Prime number is one which is divisible by 1 and itself only i.e. a Prime number has no other divisor other than I and itself. Examples of Prime number are 2.3.5.7.11 and so on. Once you are done editing your source code, make sure to save it (save often to prevent loss of data and work) and then compile your source code. The next step is to follow the submission guidelines in Section 2 of this document and turn your lab in
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