Question: Creation in Java code: Description: a) Creation of a text file in the current working directory of your project having marks of unspecified

Creation in Java code:

 

Description:

 

a) Creation of a text file in the current working directory of your project having marks of unspecified courses (more than 5) separated by spaces. Give the name of the text file as firstname.txt. You can see my sample file for your reference: 

 

Tooks VCS Window Help 23.45 34.56 78.34 67.34 68.21 16.89 89.23 56.43

 

b) Writing a program that prompts the user to enter the file name, read the marks from the file and displays their total and average up to two decimal places. Sample output

 

image.png


 

c)]Show the contents of the file temp.txt IN YOUR PROJECT after the following program is executed 

            public class Test 

            { public static void main(String[] args) throws java.io.IOException { 

            java.io.PrintWriter output = new java.io.PrintWriter("temp.txt"); 

            output.printf("amount is %f %e\r\n", 32.32, 32.32); 

            output.printf("amount is %5.4f %5.4e\r\n", 32.32, 32.32); 

            output.printf("%6b\r\n", (1 > 2)); 

            output.printf("%6s\r\n", "Java"); 

            output.close(); } } 
 
 


Tooks VCS Window Help 23.45 34.56 78.34 67.34 68.21 16.89 89.23 56.43

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 Programming Questions!