Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) throws Exception{
- String cont1=" ";
- String X;
- int x1,arr_count=1;
- String[] option = {"First Name","Last Name","Course"};
- BufferedReader reader1=new BufferedReader(new InputStreamReader(System.in));
- do{
- System.out.println("nWelcome! Please select a task: nA. View a record.nB. Add a record.nC. Edit a record.nD. Exit the program.");
- String option1 = reader1.readLine();
- if("a".equals(option1)|| "A".equals(option1)){
- System.out.println("Please enter the Student ID for the record to view.");
- String a = reader1.readLine();
- x1 = Integer.parseInt(a);
- for(int y=0;y<3;y++){
- System.out.print(Records.getRecord(x1,y) + " ");
- }
- System.out.print("nSubjects and Grades: n");
- for(int y=3;y<6;y++){
- System.out.print(Records.getRecord(x1,y) + " (" + Records.getRecord(x1,y+3) + ")n");
- }
- System.out.println("nReturn to Main Menu? (Y/N)");
- cont1= reader1.readLine();
- }
- else if("b".equals(option1)||"B".equals(option1)){
- arr_count++;
- for (int y = 0; y<3;y++){
- System.out.println("Enter Value for "+ option [y]+":" );
- X = reader1.readLine();
- X = Records.getRecord(arr_count,y);
- }
- System.out.println("nNew Student added:nID number: "+ arr_count);
- for(int y=0;y<3;y++){
- X = Records.getRecord(arr_count,y);
- System.out.print(X + " ");
- }
- public class Records {
- public static String getRecord(int recordID,int index1)throws Exception{
- //BufferedReader reader1=new BufferedReader(new InputStreamReader(System.in));
- String records[][] = new String [10][9];
- records[0][0] = "John"; records[0][3] = "English"; records[0][6] = "C";
- records[0][1] = "Smith"; records[0][4] = "Math"; records[0][7] = "B";
- records[0][2] = "BS IT"; records[0][5] = "Graphics"; records[0][8] = "A";
- records[1][0] = "Juan"; records[1][3] = "Graphics"; records[1][6] = "B";
- records[1][1] = "Ponce"; records[1][4] = "Math"; records[1][7] = "B";
- records[1][2] = "BS ECE"; records[1][5] = "Robotics"; records[1][8] = "A";
- /**records[2][0] = ""; records[2][3] = ""; records[2][6] = "";
- records[2][1] = ""; records[2][4] = ""; records[2][7] = "";
- records[2][2] = ""; records[2][5] = ""; records[2][8] = "";
- records[3][0] = ""; records[3][3] = ""; records[3][6] = "";
- records[3][1] = ""; records[3][4] = ""; records[3][7] = "";
- records[3][2] = ""; records[3][5] = ""; records[3][8] = "";
- records[4][0] = ""; records[4][3] = ""; records[4][6] = "";
- records[4][1] = ""; records[4][4] = ""; records[4][7] = "";
- records[4][2] = ""; records[4][5] = ""; records[4][8] = "";*/
- return records[recordID][index1];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement