A program to implements the sequence interface

Assignment Help Computer Engineering
Reference no: EM132192970

Question :

Write algorithms and programs to create a class PrimeSequence that implements the Sequence interface.

Provide a Demo class that will produce an arbitrary sequence of n prime numbers in table format and will perform an analysis of those n prime numbers.

Output: Output will provide a table of n prime numbers. The table will be as close to "square" as possible - i.e. same number of rows and columns - with at most 10 entries per row. All entries will be right-aligned. Additionally, output will include a "histogram" of the occurrences of the last digit [0-9] of each prime number.

The histogram will be horizontal, may be scaled, and each entry must fit on a single row. All output should be handled by the Demo class. Additional details of the histogram will be discussed in class.

Input: Input will be provided by the command-line. Two input constants will be placed on the command-line upon execution. For example: java SequenceDemo 6 50 ; where the prime sequence will start with the next prime after the first number, and the second number (n) is the number of prime numbers to be sequenced.

Both numbers will be integers and both numbers must be 1 or greater. Instructions for compilation/execution should include command-line input details.

REQUIREMENTS:

No switch or breaks statements allowed.

You must write at least THREE programs: one will be the Sequence interface with a next() method; one will be the PrimeSequence class that will implement the interface; and one will be the SequenceDemo class that will perform the demonstration/analysis.

The Sequence interface will provide for the next() method. Interface will use class documentation standards.

The PrimeSequence class will implement the next() method, a method to determine if a number is prime, and any other methods/instance variables required for the class.

The SequenceDemo class will accept and validate the command-line input, request the specified number (n) of primes, starting were specified, collecting data for analysis, and preparing the table for output. The analysis will entail counting how many instances of each digit [0-9] occur on the last digit of each prime.

Reference no: EM132192970

Questions Cloud

An ethernet frame consists of a fixed-length header : The older versions of Ethernet have remained compatible with newer versions due to the frame format which has remained constant.
What is the efficiency class of this algorithm : Write an algorithm in pseudocode to perform the multiplication of a matrix with a vector. b. What is the main operation of this algorithm?
Find the longest word in an english sentence : Write an algorithm (using pseudocode) to find the longest word in an English sentence, where a sentence is a sequence of words and spaces.
Write an application that prints the integer numbers : Write an application that prints the integer numbers from 1 to 60 along-with the square root value of only even numbers.
A program to implements the sequence interface : Write algorithms and programs to create a class PrimeSequence that implements the Sequence interface.
Write an algorithm to implement a stack using two queues : Write an algorithm to implement a stack using two queues (say q1 and q2). Specifically, you need to implement the pop() and push() functions of a stack.
An algorithm that takes an array of any size : Write an application in Java which includes an algorithm that takes an array of any size, selects the high and low integer from the array of integers.
Write an application that accepts a users password : Write an application that accepts a user's password from the keyboard. When the entered password is less than six characters, more than 10 characters.
Write an algorithm to solve the independent set problem : Write an algorithm to solve the Independent set problem. In English describe the way the input is given; the output; your assumptions etc.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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