0% found this document useful (1 vote)
105 views2 pages

Name String Mobilenumber String Username String Password String

The document provides instructions for writing user data from an ArrayList of User objects to an external CSV file, specifying that a FileWriter and BufferedWriter should be used to write the data to an "output.csv" file from a main method that gets user input. It describes a User class with name, mobileNumber, username, and password attributes and a UserBO class with a static writeFile method to write all user details in the ArrayList to the BufferedWriter.

Uploaded by

samrudhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
105 views2 pages

Name String Mobilenumber String Username String Password String

The document provides instructions for writing user data from an ArrayList of User objects to an external CSV file, specifying that a FileWriter and BufferedWriter should be used to write the data to an "output.csv" file from a main method that gets user input. It describes a User class with name, mobileNumber, username, and password attributes and a UserBO class with a static writeFile method to write all user details in the ArrayList to the BufferedWriter.

Uploaded by

samrudhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

FILE WRITING

File Writing
 
Use FileWriter and BufferedWriter to write the data to a file. As a first thing, we are
gonna create a file that contains the record of all the users registered. So write a
program that can write all the user details from the console into a file "output.csv".

Strictly adhere to the Object-Oriented specifications given in the problem statement. All class
names, attribute names, and method names should be the same as specified in the problem
statement.

Consider the class User with the following attributes, 


Attribute Data type
name String
mobileNumber String
username String
password String
 
Consider the class UserBO with the following methods,
Method Name Description
This method gets a list o
public static void writeFile(ArrayList<User> userList, BufferedWriter bw)
writes all the user details in t

Consider the class Main and use the main method to get the details from the user.

The link to download the template code is given below


Code Template

Input format:

The first line of input consists of an integer that corresponds to the number of users.
The next n line of input consists of user details in  the CSV format (name,
mobileNumber, username, password)
Refer to sample Input for other further details.

Output format:

Write the user details in the output.csv file.


Refer to sample Output for other further details.
Sample Input:
[All Texts in bold corresponds to the input and rest are output]

Enter the number of users:


3
Enter the details of user :1
Jane,1234,jane,jane
Enter the details of user :2
John,5678,john,john
Enter the details of user :3
Jill,1357,jill,jill
Sample Output: (output.csv)

You might also like