Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribedimage text in transcribed

image text in transcribedimage text in transcribedimage text in transcribed

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

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

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions