Question: Write a program that opens a file of integers numbers.txt and produces an output file that contains a table with each integer from the input

Write a program that opens a file of integers numbers.txt and produces an output file that contains a table with each integer from the input file and an indication of the properties of the number. The three properties will be 1) does it contain repeating (adjacent) digits? 2) is it even? 3) is it prime.

For example, if the input file, numbers.txt contained:344 171 88

90 51 221 11 111 

The resulting output file numberSummary.txt would contain:

 Repeat Number Digits Even Prime 
 344 + + - 171 - - - 88 + + - 90 - + - 51 - - - 221 + - - 11 + - + 111 + - - 

You must write three methods to test for the number properties:

isPrime(n) - takes an integer value and returns true if the number is prime, false otherwise isEven(n) - takes an integer value and returns true if the number is even, false otherwise isRepeatedDigits(n) - takes an integer value and returns true if the number contains the same digit in adjacent locations in the number, false otherwise

Your main( ) method will use the required methods to produce the well labelled table. A + in the table indicates that thenumber possesses that property, a - indicates it does not.

Your table must be formatted as shown, no use of spaces or tabs is permitted. Your methods should be well-documented using @param and @return tags in the comments. There are an unknown number of integers in the input file, however, you may assume the file contains only integers > 1.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!