Question: Part 1 : Complete the following code to write the following data to a file named data.txt Name : Your Name Student Id : Your
Part 1 : Complete the following code to write the following data to a file named data.txt
Name : Your Name
Student Id : Your Id
Grades :
Database 86
Advanced Programming 85
System Analysis 80
public class Main {
public static void main(String[] args) throws java.io.FileNotFoundException{
java.io.File file = new java.io.File("");
java.io.PrintWriter output = new java.io.PrintWriter(file);
// Write formatted output to the file
output.print( ); .. .. .. ..
output.close();
// Complelete the following code to Read data from the file
java.util.Scanner input = new java.util.Scanner( . );
String name = input.next(); . . . . . . .
System.out.println( . . . );
}
// Close the file
input.close(); } }
Show The execution of your code :
Part 2 Write a new version of the previous java code that allows introducing the file content by using a graphical interface.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
