Question: Write a java program that reads an integer N (2

Write a java program that reads an integer N (2 <= N <= 10000) from an input file named input7.txt and then outputs
a. All numbers that are divisible by 3 to the output file named output7A.txt
b. All primes from 2 to N to the output file named output7B.txt
Requirements:
+ For each part a) and b), define a method called readDataFromFile() that takes into account the input filename as the parameter and returns the number N.
+ In part a), write a function called printNumbersToFile() that takes the output filename as the parameter and prints out all numbers which are divisible by 3 (0 excluded).
+ In part b), write a function called
printPrimesToFile() that takes the output filename as the parameter and prints out all primes.
Example:
Input
File input7.txt
10
Output
File output7A.txt 369
File output7B.txt 2357

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!