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 a brute-force attack

What are the current OWASP Top 10 - What is a brute-force attack and how can the risks of these attacks be mitigated and What could be the impact

  List the different ways in which multiple disks can be used

List the three different ways in which multiple disks can be used in combination in a RAID system, and the corresponding benefits expected.

  Questionenlarge the size of the array to 25 driver will

questionenlarge the size of the array to 25. driver will start with 10 objects in it other than has provision for up to

  Web security consulting recommendations

Web Security Consulting Recommendations You are a security consultant for a new client in the healthcare industry. You have been asked to design a web solution

  Project to build a tic tac toe game on ios using xcode

The goal of this project is to improve your game by allowing the user to set the difficulty level for the game. I have SWIFT project to build a Tic Tac Toe game on IOS using Xcode

  How did the artifact first come to your attention

What is it about the artifact that interests you? What is your personal connection to the artifact? What about the artifact connects you to it?

  What are the major data structures used in rdbms

What are the major data structures used in the following areas : RDBMS, Network data model & Hierarchical data model. If you are using C language to implement the heterogeneous linked list, what pointer type will you use?

  Assess the importance of a systems development life cycle

write a five to six 5-6 page paper in which youdetermine within the health care setting the main features capabilities

  Write program that prompts user to provide single character

Write a program that prompts the user to provide a single character from the alphabet. Print Vowel or Consonant, depending on the user input.

  Place the following terms into the logical sequence

Place the following terms into a logical sequence. Tell why you chose this sequence.(Note: Present your reordered terms in your suggested sequence. Do not use numbers or other methods to indicate the changed sequence.)

  How many results are possible to form the board

The Codechef Programming Society has 198 membership-paying mem- bers, 97 females and 101 males.

  Define routers and switches will not be needed

the configuration process of routers and switches can be made easier, especially for non experts who want to play around with routers and switches

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