Answered step by step
Verified Expert Solution
Link Copied!

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 1 just need help with part 2.
heres my code for part 1 to use for part 2
package rancreate;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.Random;
/**
*
* @author Erik
*/
public class Rancreate {
public static void main(String[] args) throws IOException
{
String filename; // File name
int number; // Friend's name
// Create a Scanner object for keyboard input.
Scanner keyboard = new Scanner(System.in);
// Get the filename.
System.out.print("Enter the filename: ");
filename = keyboard.nextLine();
Random randomNumbers = new Random();
//number = randomNumbers.nextInt();
// Open the file.
PrintWriter outputFile = new PrintWriter(filename);
// Get data and write it to the file.
for (int i =1; i =100; i++)
{
// Get the name of a friend.
System.out.println(number = randomNumbers.nextInt(100));
// Write the name to the file.
outputFile.println(number);
}
// Close the file.
outputFile.close();
}
}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions

Question

14. m To sell property, such as airplanes, machines, buildings

Answered: 1 week ago