Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Ive done part 1 just need help with part 2 . heres my code for part 1 to use for part 2 package rancreate; import
Ive done part just need help with part
heres my code for part to use for part
package rancreate;
import java.ioIOException;
import java.ioPrintWriter;
import java.util.Scanner;
import java.util.Random;
@author Erik
public class Rancreate
public static void mainString args throws IOException
String filename; File name
int number; Friend's name
Create a Scanner object for keyboard input.
Scanner keyboard new ScannerSystemin;
Get the filename.
System.out.printEnter the filename: ;
filename keyboard.nextLine;
Random randomNumbers new Random;
number randomNumbers.nextInt;
Open the file.
PrintWriter outputFile new PrintWriterfilename;
Get data and write it to the file.
for int i ; i ; i
Get the name of a friend.
System.out.printlnnumber randomNumbers.nextInt;
Write the name to the file.
outputFile.printlnnumber;
Close the file.
outputFile.close;
Step 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