Passing the maximum number on the command line

Assignment Help Basic Computer Science
Reference no: EM131073656

The Eratosthenes sieve is a simple algorithm to find all prime numbers less than a given number.

It proceeds as follow:

  • make a collection of numbers between 2 and the given number (let's call it allNumbers)
  • make an empty collection that will receive all the prime numbers (let's call it allPrimes)
  • repeat until allNumbers is empty the following steps
    • remove the first element of allNumbers, call it prime, and put it in allPrimes
    • remove all multiple of prime from allNumbers
  • print all numbers from allPrimes

Implement this algorithm choosing appropriately what collections from the java.util package can be best for allNumbers and allPrimes.

Explain your choices in your documentation.

The deliverables are one Java class, allowing to run the sieve by passing the maximum number on the command line, the design document (no more than one page) explaining the choice of data structures, and a test document explaining how you check the correctness of your program.

Reference no: EM131073656

Questions Cloud

Calculate the ratio of the intensities : calculate the ratio of the intensities at the maximum and minimum .
Health insurance portability and accountability act : Analyze and discuss how the Health Insurance Portability and Accountability Act (HIPPA) helps to improve the U.S. healthcare industry. What are some of its challenges?
Was probably of choose boy dependent on choosing girl first : An elementary class consists of 8 boys and 10 girls. a child is chosen at random and it is a girl. a second child is randomly chosen again from the remaining children annd it is a boy. was the probably of choosing the boy dependent on choosing the..
Which of the following is true : When an object is placed 30 cm from the lens, a magnified inverted image is formed on the opposite side of the lense. An object placed at 12 cm from the lens will form an inverted image of smaller size.
Passing the maximum number on the command line : The deliverables are one Java class, allowing to run the sieve by passing the maximum number on the command line, the design document (no more than one page) explaining the choice of data structures, and a test document explaining how you check th..
How you view and interact with people from different culture : Why do you think people are shocked by their outcomes on the IA Tests - How do you think your hidden biases affect how you view and interact with people from different cultures?
Determine the rate at which energy is removed by heat : Determine the rate at which energy is removed by heat transfer
Reliance on technological systems : The transition to a higher reliance on technological systems represented a significant change in the development and use of technology and its relationships with society, including institutions within society.
Find expressions for the position (xc,zc) of the centre : Find expressions for the position (xc,zc) of the centre

Reviews

Write a Review

 

Basic Computer Science Questions & Answers

  Write this report addressing

Your supervisor has asked you to draft a brief report that describes the "Internal Use Only" data classification standard of Richman Investments.

  Under what conditions will the cable user get better service

A fraction f of these computers are online at any one time. Under what conditions will the cable user get better service than the ADSL user?

  Explaining data visualization form of business intelligence

Is data visualization a form of business intelligence? Describe why or why not? What security issues are related with data visualization?

  User manage their checkbook

You are to write a program that will help the user manage their checkbook. The program will prompt the user to enter the check number, the date, the name the check is made out to, and the amount until the check number entered is 0. Make sure you use ..

  Non-negative numbers by using repeated additions

Write a MARIE program using a loop that multiplies 2 non-negative numbers by using repeated additions. For example, to multiply 3 x 6, the program would add 3 six times (e.g. 3 + 3 + 3 + 3 + 3 + 3) or add 6 three times (e.g. 6+6+6).

  P-value of a sample outcome

Suppose the P-value of a sample outcome is 0.132. Is this outcome statistically significant at the alpha=0.05 level? At the 0.01 level?

  B2b e-marketplaces

Volkswagen operates its own proprietary B2B e-marketplaces in which its suppliers participate. What are the disadvantages to Volkswagen of not using a generic B2B e-marketplace with even more suppliers?

  What are the advantages of using variables in a data type

What are the advantages of using variables in a data type? Substantiate your response with suitable examples. Justify your answers using examples and reasoning. Comment on the postings of at least two classmates with regard to whether you agree or..

  What is the message

The following padded ASCII-coded message is stored in successive memory locations in a computer.

  What is the crux of the research problem?

What is the crux of the research problem?

  Creating truly anonymous electronic cash requires a bank to

1. refers to preventing data delays or denials.integritysecrecynecessityreadinessnbspquestion 2 refers to protecting

  Use ethernet network data link protocols

Is possible to use Ethernet network data link protocols on a Token Ring network? Explain why or why not.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd