Write java statements that output to the console

Assignment Help Computer Engineering
Reference no: EM132208487

Write a program called NumberFun.java that will determine if a positive, whole number is even, prime, a palindrome, or emirp. The input to the program is a series of numbers, one per line, read from a text file. The program should prompt the user for the input file name.

Each determination is to be written as a separate method that takes as a parameter a positive integer and returns a boolean. The following guidelines can be used in your code:

2 is the only even number that is prime. An odd integer is prime if it is not divisible by any odd integer less than or equal to the square root of the number.

A palindrome reads forward and backward in the same way. For example, the numbers, 5, 131, 2662, and 34543 are palindromes. (When determining if a number is a palindrome, do not convert the number to a string.)

An emirp is a prime number whose reversal is also a prime. For example, 11, 13, 79, and 359 are emirps.

The output lists each number in the file and displays which of the four properties hold true for that number. If none of them hold true, the number is displayed alone. For example, given the input file the output would be:

114 114 - even

4621 4621 - prime

11 11 - prime, palindrome, emirp

97 97 - prime, emirp

2 2 - even, prime, palindrome, emirp

45 45

Add a helper method called printHeading() to your application. The heading of the method should be private static void printHeading() .

In the code block of the method, write Java statements that output to the console the following:

* Your name

* The course number and section

* The Java program name and the project number

Include a Java statement at the beginning of your main method that calls the helper method, printHeading().

Reference no: EM132208487

Questions Cloud

Draw the indifference curves and budget line of that worker : Assume optimum labor time of a worker is positive. Draw the indifference curves and budget line of that worker. Show the optimum level of his labor time.
Calculate the greatest common divisor of any finite set : Write a program to calculate the greatest common divisor of any finite set of integers.
Write a program to calculate the hashing table of input data : Write a program to calculate the hashing table of input data. The program reads from the standard input the table size k.
How much higher or lower is the price level : Assume real wage in the USA is 40$, in Mexico, it is 25$ in 2000. Also, assume the nominal wage in the two countries is the same.
Write java statements that output to the console : The output lists each number in the file and displays which of the four properties hold true for that number.
Creating a brand identity using given information : People connect through stories. Storytelling is an effective way to create and sell a brand image. Choose a known brand and discuss the brands story.
How much are you reducing the other villagers profits : If you add an 8th cow, how much are you reducing the other villagers' profits? (hint: calculate their individual profits when there are 7 cows.
Write a simple classification program for types of birds : The program should ask for the color of the feathers of the bird the user is seeing. The only possible values are red, yellow, blue or green.
Write a program that calculates a students exam average : Input will be read from a single file that contains a student's name (single string with no whitespace) and 3 separate exam scores.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Determine if a binary search tree is height balanced

Write a function to apply left or right rotations to a binary search tree based on the height of the left and right sub-trees of the root.

  In a 5 bit crc error detecting scheme suppose that we

in a 5 bit crc error detecting scheme assume we choose the generating bit sequence as 11011.a encode the bit stream

  Plot generated source output vectors and quantization points

[VQ for a Gaussian Source] Using the LBG algorithm, design two-dimensional vector quantizers of rates 0.5, 1, 1.5, 2, 2.5, and 3 for a Gaussian source.

  Problem on troubleshooting dns records

Problem on Troubleshooting DNS Records

  What is maximum value of n for which your program produces

For some values of n, your program will not produce correct results. What is the maximum value of n for which your program produces a correct result? Why?

  Show a list of the 3 most recent visible threads sorted

Using the provided Thread class, show a list of the 3 most recent visible threads sorted to show the most recently created threads first.

  Identify each of the controls as physical or corrective

Suggest one or more controls to support each policy. Identify each of the controls as physical, administrative, or technical and preventative, detective.

  Encode the given message using the lzw algorithm

Given an initial dictionary consisting of the letters a b r y b, encode the following message using the LZW algorithm: abbarbarraybbybbarrayarbbay.

  Discuss the steps that would be needed to make calculator

Discuss the steps that would be needed to make the calculator process complex numbers.

  Which technology helps to make employee''s training cheaper

which technology helps to make employee's training cheaper, more individual and more effective. Based on your experience, describe a method that exploits (any form of) educational technology and specify its contribution. If possible, present non-tr..

  How does web change security for the internet

Much has been made of the new Web 2.0 phenomenon, including social networking sites and user-created mash-ups. How does Web 2.0 change security.

  Define action you would take to protect your retail business

Describe one (1) action you would take to protect your retail business from each type of shoplifter

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