This is for High School Java.
Part A
A positive integer is prime if it’s divisible by only 1 and itself. number 1 by definition is not prime.
Use this method in an application that determines & display all the prime numbers less than 10,000. how many #s up to 10,000 do you have to test to ensure that you’ve found all the primes?
Initially, you might think that n/2 is the upper limit for which you must test to see whether a number is n is prime, but you need only go as high as the square root of n. Rewrite the program and run it both ways.
Part B
Use a one-dimensional array to solve the following problem: A company pays its salspeople on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a salesperson who grosses $5000 in sales in a week receives $200 plus 9 percent of $5000, or total of $650. Write an application using an array of counters that determines how many of the salespeople earned salaries in each of the following ranges assume that each salesperson’s salary is truncated to an integer amount.
a) $200 – 299
b) $300 – 399
c) $400 – 499
d) $500 – 599
e) $600 – 699
f) $700 – 799
g) $800 – 899
h) $900 – 999
i) $1000 and over

WhatsApp us