Question
Main class for the following program:- import java.io.*; import java.util.Scanner; class studentDetails { public String name[][] = new String[10][10]; void getDetails(int n) { Scanner get
Main class for the following program:-
import java.io.*;
import java.util.Scanner;
class studentDetails {
public String name[][] = new String[10][10];
void getDetails(int n)
{
Scanner get = new Scanner(System.in);
int limit=n;
System.out.println("Enter "+limit+" Student Details ");
for(int i=0;i { System.out.println("Enter Student #"+(i+1)+" Login_ID, Password & 2 subjects name:"); for(int j=0;j<4;j++) { name[i][j] = get.nextLine(); } } display(limit); } void display(int limit) { System.out.println("Student Lgin Id"+"\t"+"Password"+"\t\t"+"Subject1"+"\t\t"+"Subject2"); for(int i=0;i { for(int j=0;j<4;j++) { System.out.print(name[i][j]+"\t\t"); } System.out.println(); } } } class collegeOffice { 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(); studentDetails std = new studentDetails(); std.getDetails(n); PrintStream output = new PrintStream(new File("StudentDetails.txt")); output.println("Student Lgin Id"+"\t"+"Password"+"\t\t"+"Subject1"+"\t\t"+"Subject2"); output.println("======================================"); for(int i=0;i { for(int j=0;j<4;j++) { output.print(std.name[i][j]+"\t\t"); } output.println(); output.println("======================================"); } output.close(); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started