Lab Description: Create a prime class that will determine if any provided number is prime. Use...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Lab Description: Create a prime class that will determine if any provided number is prime. Use this class to tell all numbers in the data file for primeness. A prime number is any number that is only divisible by 1 and itself. Sample Data: 18 1201 77 1213 88 1217 99 121 1431 1223 141 234 97 47 7 547 2456 34 Sample Output: 1201 IS PRIME. 77 IS NOT PRIME. 1213 IS PRIME. 88 IS NOT PRIME. 1217 IS PRIME. 99 IS NOT PRIME. 121 IS NOT PRIME. 1431 IS NOT PRIME. 1223 IS PRIME. 141 IS NOT PRIME. 234 IS NOT PRIME. 97 IS PRIME. 436 IS NOT PRIME. 47 IS PRIME. 7 IS PRIME. 547 IS PRIME. 2456 IS NOT PRIME. 34 IS NOT PRIME. Files Needed :: Prime.java Prime Runner.java import static java.lang. System. *; import java.lang. Math; public class Prime { private int number; //constructor methods go here public void setPrime (int num) //boolean isPrime () goes here public String toString() { return import java.io.IOException; import java.io.File; import java.util.Scanner; import static java.lang.System.*; import java.lang.Math; public class PrimesRunner { public static void main( String args[]) throws IOException 18 1201 77 1213 88 1217 99 121 1431 1223 141 234 97 436 128 92 47 7 547 2456 34 Lab Description: Create a prime class that will determine if any provided number is prime. Use this class to tell all numbers in the data file for primeness. A prime number is any number that is only divisible by 1 and itself. Sample Data: 18 1201 77 1213 88 1217 99 121 1431 1223 141 234 97 47 7 547 2456 34 Sample Output: 1201 IS PRIME. 77 IS NOT PRIME. 1213 IS PRIME. 88 IS NOT PRIME. 1217 IS PRIME. 99 IS NOT PRIME. 121 IS NOT PRIME. 1431 IS NOT PRIME. 1223 IS PRIME. 141 IS NOT PRIME. 234 IS NOT PRIME. 97 IS PRIME. 436 IS NOT PRIME. 47 IS PRIME. 7 IS PRIME. 547 IS PRIME. 2456 IS NOT PRIME. 34 IS NOT PRIME. Files Needed :: Prime.java Prime Runner.java import static java.lang. System. *; import java.lang. Math; public class Prime { private int number; //constructor methods go here public void setPrime (int num) //boolean isPrime () goes here public String toString() { return import java.io.IOException; import java.io.File; import java.util.Scanner; import static java.lang.System.*; import java.lang.Math; public class PrimesRunner { public static void main( String args[]) throws IOException 18 1201 77 1213 88 1217 99 121 1431 1223 141 234 97 436 128 92 47 7 547 2456 34
Expert Answer:
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these computer network questions
-
In this programming assignment you will practice using ArrayLists, Inheritance and Polymorphism. You are to write a game called Magical Creatures War. You will do this by implementing a class called...
-
As purchasing agent for Laurentian Enterprises in Quebec City, you ask your buyer to provide you with a ranking of excellent, good, fair or poor for a variety of characteristics for two potential...
-
The management of Gawain plc is evaluating two projects whose returns depend on the future state of the economy as shown below: Probability __________ IRRA(%) ___________ IRRB(%)...
-
What factors should a buyer consider when deciding with which vendors to develop a close relationship?
-
Consider the payoff depicted in the following figure, depending on ST , the price of an underlying stock share at time T. Find a trading strategy that replicates this payoff. You may use...
-
Jackson Products produces a barbeque sauce using three departments: Cooking, Mixing, and Bottling. In the Cooking Department, all materials are added at the beginning of the process. Output is...
-
1. Compute the loo and 12 norms of the following matrix and find the vectors x that achieves the maximum in the definition for the l case (20 pts): -1 5 2 4 - 7 -6 5 -2 - -9 11 - -3 4 -2 6 -2
-
Two slender rods of negligible weight are pin-connected at C and attached to blocks A and B, each of weight W. Knowing that P = 1.260W and that the coefficient of static friction between the blocks...
-
Conduct a detailed study and present your findings surveillance Radars used in the detection of Drones or Umanned Ariel Vehicles (UAVs). With the understanding of the Drone technology and Radar...
-
would you like to take your pick? Which destination would you prefer to visit. Pleasename3 places you would like to see and 3 things you would like to do. If you pick the Caribbean, please give the...
-
How do cellular respiration and external respiration differ in their respective processes and physiological significance?
-
Compare and contrast the mechanisms of organogenesis in invertebrate and vertebrate embryos, highlighting key similarities and differences.
-
Kumar adds a "finish no later than" date constraint to his schedule. Two activities now show that they will finish later than the project complete milestone. How can he address this negative slack?...
-
Consider fruit farmers planting fruit trees and sell fruits in the market to earn a living. besides providing earnings to the fruit farmers, the fruit trees also beautify the environment and help to...
-
Find each of the following functions. fx) = Vx, gtx)- V8-x %3D (a) fog State the domain of the function. (Enter your answer using interval notation.) (b) gof State the domain of the function. (Enter...
-
(a) Bright Sdn Bhd (BSB) is a tax resident manufacturing company in Johor, which involves in ceramic tiles. Currently, BSBs annual sales turnover has been forecasted to be around RM 300,000 for the...
-
The arrays list1 and list2 are identical if they have the same contents. Write a method that returns true if list1 and list2 are identical, using the following header:public static...
-
Write a program that animates the merge of two sorted lists. Create two arrays, list1 and list2, each of which consists of 8 random numbers from 1 to 999. The array elements are displayed, as shown...
-
Rewrite Programming Exercise 15.24 so that the ball?s opacity is changed as it swings. Write a program that animates a palindrome swing as shown in Figure. Press/release the mouse to pause/resume the...
-
Tablet Tailors sells tablet PCs combined with Internet service (Tablet Bundle A) that permits the tablet to connect to the Internet anywhere (set up a Wi-Fi hot spot). The price for the tablet and a...
-
Economy Appliance Co. manufactures lowprice, no-frills appliances that are in great demand for rental units. Pricing and cost information on Economys main products are as shown on page 943. Customers...
-
Grill Master Company sells total outdoor grilling solutions, providing gas and charcoal grills, accessories, and installation services for custom patio grilling stations. Instructions Respond to the...
Study smarter with the SolutionInn App