Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.io.*;
- import filestuff.*;
- public class StudentStuff
- {
- public static void studentInfo(String[][]g,String studentName)
- {
- Scanner in=new Scanner(System.in);
- boolean c=false;
- for(int i=0;i<g.length;i++)
- {
- if(g[i][0].equals(studentName))
- {
- System.out.println("**Class number:"+ (g[i][1])+"\n **Class name:"+(g[i][2])+"\n **Final grade:"+(g[i][3]));
- c=true;
- }
- }
- if(c==false)
- {
- System.out.println("No student named "+studentName+" found.");
- }
- }
- public static void main(String[]args)
- {
- String[][]g=FileHandle.genFile();
- Scanner in=new Scanner(System.in);
- String choice="";
- choice=FileHandle.getUserInput("Type 1 to get a student's info:\n Type 2 to type in a class name to output file with student list:\n Type 3 to enter a class name/number to see average grade:\n Type 4 to quit.\n");
- int numchoice=Integer.parseInt(choice);
- if(numchoice==1)
- {
- String studentName=FileHandle.getUserInput("Enter name of student:\n");
- studentInfo(g,studentName);
- }
- else if(numchoice==2)
- {
- String classchoice=FileHandle.getUserInput("Type class you wish to view list of:");
- int rows=g.length;
- for(int i=0;i<rows;i++)
- {
- if((g[i][2]).equals(classchoice))
- {
- System.out.println(g[i][0]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement