Question: Task 1 (15 pts.) The program task1.java given below is an incomplete program. The goal of the program is to: Read a file that contains

 Task 1 (15 pts.) The program task1.java given below is anincomplete program. The goal of the program is to: Read a filethat contains integers. Determine if each of those integers is a prime

Task 1 (15 pts.) The program task1.java given below is an incomplete program. The goal of the program is to: Read a file that contains integers. Determine if each of those integers is a prime or not. 1. 2. Complete that program, by defining a check_primes function, that satisfies the following specs: Function check_primes takes two arguments, called in file, out file. Argument in file specifies the name of the input file, that contains the integers to be processed. Argument out_file specifies the name of the output file, where the results will be saved. If in_file opening file for reading" and return. cannot be opened for reading, the function should print on the screen "Error in . If out_file cannot be opened for writing, the function should print on the screen "Error in opening file for writing" and return. Otherwise, if both in file and out_file can be opened: for each integer X stored in in_file, the function writes to out_file a line stating either "X is prime" or "X is not prime" For example, for input file in1.txt (format given below), the program should produce an output file that looks EXACTLY like out1.txt (format given below) IMPORTANT: You are NOT allowed to modify in any way the main function

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!