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

  What is the big-o running time of the given code

What is the Big-O running time of the subsequent code fragment and If an ArrayList is passed for lst1 and lst2.  Describe your answer.

  Define organizations access control policy

Research how organizations Access Control Policy builds enforcement measures to ensure their access control system is effective and safe.

  Display all numbers in this computation using labels

If the second number is NOT a zero, do the operation, display all numbers in this computation using labels, and add them to the results.txt file.

  The dice in a craps round is called the "come out roll"

In the game of Craps, a "Pass Line" bet proceeds as follows. Using two six-sided dice, the first roll of the dice in a craps round is called the "Come Out Roll". The bet immediately wins as the come out roll is 7 or 11, and loses when the come out..

  List what might be done to provide fault tolerance

Equipment and system failure: Search for information on system and equipment failure on your favorite search engine.

  The difference between animation and transition effects

When are they appropriate? When is it better not to use them? Can you give me an examples.

  Draw toplevel data flow diagram for fiat for football method

Draw a Context Diagram for the FIAT for Football process. Draw a top level Data Flow Diagram for the FIAT for Football method. Blow up any one non-trivial process into a first level Data Flow Diagram.

  Designing the flow chart and algorithm

Write down an algorithm and develop a flow chart to find all the people who have computer experience and at least five years of company service.

  What kind of control structure would you use

What kind of control structure would you use to decide which segment a given letter falls into and to print out the corresponding digit?

  Depiction of situation with flow chart

Physical goods are shipped back to supplier if they are discovered to be damaged upon arrival at the receiving warehouse.

  Design an application that instantiates an object

Design an application that instantiates an object of each type and demonstrates all the methods.

  How did you find out the dotted quad address that is what

the current ip address standard is 32 bits. ipv6 will increase the address length to 128 bits. an ip socket address is

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