Answered step by step
Verified Expert Solution
Question
1 Approved Answer
language is java . Open up a new Java project on Eclipse named Review and create a new class called Review.java. Note that you may
language is java
. Open up a new Java project on Eclipse named Review and create a new class called Review.java. Note that you may need to install Eclipse on your home computer first. See the tutorial under the Orientation Module o If you cannot get Eclipse installed, please let me know. This activity should be complete individually. o If you get stuck writing the code, refer to the lesson video (I go step-by-step over how to complete this activity) and the review notes below covering methods, File I/O and arrays Copy and paste the below starter code into your file: * /** @author FILL IN YOUR NAME HERE * CIS 36B, Activity 1.3 */ //write your two import statements here public class Review { public static void main(String[] args) { //don't forget IOException File infile = new File("scores.txt"); //declare scores array //Use a for or while loop to read in data from scores.txt to the array // call method //Use a for loop to write data from array into extraCredit.txt /** * Write complete Javadoc comment here //write your addExtraCredit method here } Next, create a new text file named scores.txt Rick-click the project. Go to New->File. . Name your file scores.txt Make sure the text file gets saved inside the overall project folder (Review), not in the src folder Now, copy and paste the following data (exam scores) into your scores.txt file: 90 95 86 41 79 56 90 83 74 98 56 81 64 99 12 Your program must declare an array of integers, and populate the array with the contents of the file. o You may assume that the length of the array is known to be 15 elements. Next, write a method called addExtraCredit: o The addExtraCredit method takes in one parameter - an array of integers o It adds 2 to each element in the array (hint: think for loop) o It returns nothing Inside of main, call the addExtraCredit method, passing it the array of exam scores. Next, write the contents of the array to a file named extraCredit.txt. o Use PrintWriter to write out to the file (see lesson notes above). When you are finished, extraCredit.txt should contain the following: . Don't forget the title! Scores with Extra Credit: 92 97 88 43 81 58 92 85 76 100 58 83 66 101 14 Hint: Your program should include either 3 for loops or 2 for loops and a while loop. When extraCredit.txt contains the above data, submit Review.java to CanvasStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started