-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstructor.java
More file actions
52 lines (45 loc) · 1.44 KB
/
Instructor.java
File metadata and controls
52 lines (45 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import java.io.*;
import java.util.Scanner;
interface Ins{
int logInn(String user, char[] pass);
String viewAssignment(String name);
}
public class Instructor implements Ins{
String info;
String tempUsername;
public int logInn(String user, char[] pass) {
String tempPassword;
try {
Scanner x = new Scanner(new File("C:\\Users\\hp 2540p\\OneDrive\\Documents\\Semester II\\OOP Lab\\Course Management System\\Instructor_Records.txt"));
x.useDelimiter("[,\n]");
while(x.hasNext()){
tempUsername=x.next();
tempPassword=x.next();
if(tempUsername.equals(user)&&tempPassword.equals(String.valueOf(pass))){
info=tempUsername+"\n"+tempPassword+"\n"+x.next()+"\n"+x.next()+"\n"+x.next()+"\n"+x.next()+"\n"+x.next()+"\n"+x.next();
return 0;
}
x.nextLine();
}
x.close();
}
catch(Exception f){
f.printStackTrace();
}
return 1;
}
public String viewAssignment(String name) {
String assign="";
try {
Scanner x = new Scanner(new File(name+".txt"));
while(x.hasNextLine()){
assign+=x.nextLine()+"\n";
}
x.close();
}
catch(Exception f){
return "No Submissions Found";
}
return assign;
}
}