Write an application to save, retrieve and modify the student survey data. This
ID: 3771068 • Letter: W
Question
Write an application to save, retrieve and modify the student survey data. This application is divided into 2 module Student module and Instructor module. (In Java, eclipse)
Student Module:
• Students will be ask to enter survey data (StudentId, LastName, FirstName, Street, City, State)
• Ask Students to confirm if the data entered is correct. (Y/N)
• Survey data should be saved in a text file in alphabetical order by LastName (use either ArraySortedList or RefSortedList). The directory to save your file is User/SurveyDir/.
Instructor Module:
o Instructor should be able to retrieve the survey entry by StudentId and/or LastName from the file. o Instructor should be able to remove an entry using StudentId or LastName from the file.
Explanation / Answer
I have written a small java code for getting the student information from the user and then storing the same information in a text file.
Working java code for the same will be:
import java.io.*;
import java.util.Scanner;
class appStudent {
public String name[][] = new String[10][10];
void enter_details(int n)
{
Scanner get = new Scanner(System.in);
int limit=n;
System.out.println("Enter "+limit+" Student Details ");
for(int i=0;i<limit;i++)
{
System.out.println("Enter Student #"+(i+1)+" Name, Roll Number & Marks:");
for(int j=0;j<3;j++)
{
name[i][j] = get.nextLine();
}
}
myprint(limit);
}
void myprint(int limit)
{
System.out.println("Student Name"+" "+"Roll"+" "+"Marks");
for(int i=0;i<limit;i++)
{
for(int j=0;j<3;j++)
{
System.out.print(name[i][j]+" ");
}
System.out.println();
}
}
public static void main(String args[]) throws IOException
{
Scanner in = new Scanner(System.in);
System.out.print("Enter Number of Students:");
int n = in.nextInt();
appStudent std = new appStudent();
std.enter_details(n);
PrintStream output = new PrintStream(new File("output.txt"));
output.println("Student Name"+" "+"Roll"+" "+"Marks");
output.println("======================================");
for(int i=0;i<n;i++)
{
for(int j=0;j<3;j++)
{
output.print(std.name[i][j]+" ");
}
output.println();
output.println("======================================");
}
output.close();
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.