Skip to content

Commit

Permalink
Merge pull request #1 from AsifShawon/master
Browse files Browse the repository at this point in the history
yyoo
  • Loading branch information
AsifShawon authored Jul 27, 2024
2 parents f31580d + af2e78d commit 7353f52
Show file tree
Hide file tree
Showing 1,067 changed files with 26,040 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.zip
*.jar
*.rar
*.tar
.metadata
.idea
*.pdf
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>JAVA</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
10 changes: 10 additions & 0 deletions 12Bar/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
28 changes: 28 additions & 0 deletions 12Bar/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>12Bar</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1687262205831</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
2 changes: 2 additions & 0 deletions 12Bar/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
14 changes: 14 additions & 0 deletions 12Bar/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
Binary file added 12Bar/bin/Assignment2/Action.class
Binary file not shown.
Binary file added 12Bar/bin/Assignment2/Course.class
Binary file not shown.
Binary file added 12Bar/bin/Assignment2/CourseManagement.class
Binary file not shown.
Binary file added 12Bar/bin/Assignment2/Session.class
Binary file not shown.
Binary file added 12Bar/bin/Assignment2/Student.class
Binary file not shown.
Binary file added 12Bar/bin/Assignment2/Ta.class
Binary file not shown.
Binary file added 12Bar/bin/Assignment2/Teacher.class
Binary file not shown.
Binary file added 12Bar/bin/Assignment2/User.class
Binary file not shown.
7 changes: 7 additions & 0 deletions 12Bar/src/Assignment2/Action.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package Assignment2;

public interface Action {

public void handleAction();

}
73 changes: 73 additions & 0 deletions 12Bar/src/Assignment2/Course.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package Assignment2;


public class Course {
private String courseName;
private String section;
private String time;
private String teacher;
private String ta;

public Course()
{

}

public Course(String courseName,String section, String time, String teacher, String ta)
{
this.courseName = courseName;
this.section = section;
this.time = time;
this.teacher= teacher;
this.ta = ta;
}

void addCourse()
{
Session session = Session.getSession();

}

public String getCourseName() {
return courseName;
}

public void setCourseName(String courseName) {
this.courseName = courseName;
}

public String getSection() {
return section;
}

public void setSection(String section) {
this.section = section;
}

public String getTime() {
return time;
}

public void setTime(String time) {
this.time = time;
}

public String getTeacher() {
return teacher;
}

public void setTeacher(String teacher) {
this.teacher = teacher;
}

public String getTa() {
return ta;
}

public void setTa(String ta) {
this.ta = ta;
}



}
78 changes: 78 additions & 0 deletions 12Bar/src/Assignment2/CourseManagement.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package Assignment2;


public class CourseManagement{

static void viewCourse(Session s){
s.getCourseList();
}

public static void main(String[] args) {

while(true)
{
Session session = Session.getSession();

System.out.println("Email: ");
String email = session.inputScanner.nextLine();
System.out.println("Password: ");
String password = session.inputScanner.nextLine();
User user = null;
try
{
user = login(email,password);
}
catch(Exception ex)
{
getMessage();
continue;
}

if(user.getEmail().startsWith("teacher")) {
Teacher teacher = new Teacher();
teacher.handleAction();
}

else if(user.getEmail().startsWith("student")) {
Student student = new Student();
student.handleAction();
}

else if(user.getEmail().startsWith("ta")) {
Ta ta = new Ta();
ta.handleAction();
}
else {
continue;
}

}


}

public static User login(String email, String password) throws Exception{
Session session = Session.getSession();

User[] list = new User[7];
list = session.getUserList();
for(int i=0 ; i<7; i++)
{
if(email==list[i].getEmail() && password==list[i].getPassword())
{
return list[i];
}
}
throw new Exception("User not found");
//for wrong credential: throw new Exception("User not found");
//call getMessage() on the exception instance to get the error message
}

public static void getMessage()
{
System.out.println("User not found");
}

}


137 changes: 137 additions & 0 deletions 12Bar/src/Assignment2/Session.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
package Assignment2;

import java.util.*;

public class Session {
private static Session session = null;
private User userList[] = new User[7];
private Course courseList[] = new Course[6];
public Scanner inputScanner = new Scanner(System.in);


private Session()
{
createDatabase();
}

private static void createDatabase()
{
//getSession();

//for USer 1(Student)
session.userList[0].setEmail("student_a@northsouth.edu");
session.userList[0].setPassword("password");
session.userList[0].setId("S1");
session.userList[0].setName("A");
session.userList[0].setCGPA(3.4);
//session.userList[0].setCourses();

//for User 2(Student)
session.userList[1].setEmail("student_b@northsouth.edu");
session.userList[1].setPassword("password");
session.userList[1].setId("S2");
session.userList[1].setName("B");
session.userList[1].setCGPA(3.6);

//for User 3(Student)
session.userList[2].setEmail("student_c@northsouth.edu");
session.userList[2].setPassword("password");
session.userList[2].setId("S3");
session.userList[2].setName("B");
session.userList[2].setCGPA(3.2);

//for User 4(Teacher)
session.userList[3].setEmail("teacher_a@northsouth.edu");
session.userList[3].setPassword("password");
session.userList[3].setId("T1");
session.userList[3].setName("A");

//for User 5(Teacher)
session.userList[4].setEmail("teacher_b@northsouth.edu");
session.userList[4].setPassword("password");
session.userList[4].setId("T2");
session.userList[4].setName("B");

//for User 6(TA)
session.userList[5].setEmail("ta_a@northsouth.edu");
session.userList[5].setPassword("password");
session.userList[5].setId("A1");
session.userList[5].setName("A");


//for User 7(TA)
session.userList[6].setEmail("ta_b@northsouth.edu");
session.userList[6].setPassword("password");
session.userList[6].setId("A2");
session.userList[6].setName("B");



//for Course A 1
session.courseList[0].setCourseName("Course A") ;
session.courseList[0].setSection("1");
session.courseList[0].setTime("A");
session.courseList[0].setTeacher("T1");
session.courseList[0].setTa("A");

//for course A 2
session.courseList[1].setCourseName("Course A");
session.courseList[1].setSection("2");
session.courseList[1].setTime("A");
session.courseList[1].setTeacher("T2");
session.courseList[1].setTa("A");



//for Course A 3
session.courseList[2].setCourseName("Course A");
session.courseList[2].setSection("3");
session.courseList[2].setTime("B");
session.courseList[2].setTeacher("T1");
session.courseList[2].setTa("B");

//for Course B 1
session.courseList[3].setCourseName("Course B");
session.courseList[3].setSection("1");
session.courseList[3].setTime("A");
session.courseList[3].setTeacher("T1");
session.courseList[3].setTa("A");

//for Course C 1
session.courseList[4].setCourseName("Course C");
session.courseList[4].setSection("1");
session.courseList[4].setTime("B");
session.courseList[4].setTeacher("T2");
session.courseList[4].setTa("A");

//for Course C 2
session.courseList[5].setCourseName("Course C");
session.courseList[5].setSection("2");
session.courseList[5].setTime("C");
session.courseList[5].setTeacher("T1");
session.courseList[5].setTa("B");


}


public static Session getSession()
{
if (session == null)
{
session = new Session();
}
return session;
}

public Course[] getCourseList()
{
return courseList;
}

public User[] getUserList()
{
return userList;
}

}
Loading

0 comments on commit 7353f52

Please sign in to comment.