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.

Part 1 : Complete the following code to write the following datato a file named data.txt Name : Your Name Student Id :

Your Id Grades : Database 86 Advanced Programming 85 System Analysis 80public class Main { public static void main(String[] args) throws java.io.FileNotFoundException{ java.io.Filefile = new java.io.File(""); java.io.PrintWriter output = new java.io.PrintWriter(file); // Write formatted

What is wrong with it ??

14. Eile Edit Yiew Navigate Gode Analyze Befactor Build Run Iools VC5 Window Help Project-Main.java Eile Edit Yiew Navigate Gode Analyze Befactor Build Run Iools VC5 Window Help Project- Main,java import java. awt.*; import java, awt,event.ActionEvent; import java, awt.event.ActionListener: import java,io.File: import java io. FileNotFoundException; import java,io.PrintWriter: import java,util. Scanner: public class Main extends Frong \{ private JLabel naneLabel; private JTextField nameTextField; private JLabel iclabel; private JTextField idTextField: private JLabel databaselabel; private JTextField databaseTextField; private JLabel advancedProgranmingLabel; private JTextField advancedProgrammingTextFie Mu Eile Edit yiew Navigate Gode Analyze Befactor Build Run Iools VG5 Window Help Project- JFramejava // initialize the nane label nanelabel=newJLabel(text:"Wame:"); add the name label to the JFrane add(nanelabel); initialize the nane text field naneTextField = new JTextField( columns: 20); add the name text field to the JFrane add(naneTextField)

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!