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

  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