Refine the student manager program to manipulate the student information from files by using the Buffered Reader and Buffered Writer

Refine the student manager program to manipulate the student information from files by using the Buffered Reader and Buffered Writer

Hello friends i hope you like my previous post, in today’s post we are going discuss about, “Refine the student manager program to manipulate the student information from files by using the Buffered Reader and Buffered Writer”

(note : programs based on gtu syllabus)

So you have to  Refine the student manager program to manipulate the student information from files by using the Buffered Reader and Buffered Writer 

so now let’s discuss the logic, how you can implement it

Implementation

  • First import header files which are necessary for program
    • BufferedReader
    • BufferedWriter
    • FileReader
    • FileWriter
  • Now define the variables in main class
    •  Integer 
      • i = 0;

So you have to write program that Take input from file and check character by character if character is in lower case than convert in upper case or if character in upper case convert in to lower case (Note: file can be of any extension Ex: “.txt” )

So here first you have to write some student’s information to file, for that you have to make use of File Handling classes of java 

  • for writing data into file “FileWriter” AND “BufferedWriter” class is used
  • for reading data from file “FileReader” AND BufferedReader“class is used

First file contains  any “text” you have to scan all text from first file character by character convert characters case and store in second file

you have to use “DO WHILE LOOP” cause you have to take all the characters from file and convert in  opposite character case

READING DATA FROM FILE

Now let’s discuss about reading data from file, for Reading data from you have to create object of “BufferedReader” class inside that pass “FileName” using “FileReader” class

Example:

Inside “DO WHILE LOOP” in every iteration of loop you have to initialize one character in variable ” ” i ”  using “read()” method of “BufferedReader”

if variable ” i ” is not equal to -1 then check character is in Upper case or Lower case make sure use type casting cause we are initializing character in integer variable 

if character in lower case than convert into upper case or character in Upper case than convert into Lower case and than store into new file using “write()” method of “BufferedWriter”

if character not in Upper case nor in Lower case than write as it is in new file using “write()” method of “BufferedWriter”

perform this operation while variable ” i ” is not equal to -1

example:

so here’s our programming logic discussion is completed for “Refine the student manager program to manipulate the student information from files by using the Buffered Reader and Buffered Writer” 

Check Out other post – Create a class called Student. Write a student manager program to manipulate the student information from files by using FileInputStream and FileOutputStream

so here your program’s solution, check program below the post for reference

these are the java basic programs based on gtu syllabus

Program :

OUTPUT :

stdinfo.txt

Refine the student manager program to manipulate the student information from files by using the Buffered Reader and Buffered Writer

newstdinfo.txt

Refine the student manager program to manipulate the student information from files by using the Buffered Reader and Buffered Writer

Program As per GTU Syllabus

if you like the the way of explanation tell us in comment section you can also write the queries about this program we are defiantly going reply

share this post with your college friends so everyone can get benefit of it good bye friends see you in next post happy coding

Add a Comment

Your email address will not be published. Required fields are marked *