Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/copilot.data.migration.ask2agent.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions src/main/java/org/codedifferently/Main.java

This file was deleted.

15 changes: 15 additions & 0 deletions src/main/java/org/codedifferently/cbtyson/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.codedifferently.cbtyson;

import org.codedifferently.cbtyson.menus.MainMenu;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {

MainMenu mainMenu = new MainMenu();
mainMenu.promptMainMenu();


}
}
34 changes: 34 additions & 0 deletions src/main/java/org/codedifferently/cbtyson/data/Group.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.codedifferently.cbtyson.data;

import java.util.ArrayList;

public class Group {
String name;
String groupID;
int size;
ArrayList<Student> studentList;


public Group(String name, String groupID, int size, ArrayList<Student> studentList) {
this.name = name;
this.groupID = groupID;
this.size = size;
this.studentList = studentList;
}

public String getName() {
return name;
}

public ArrayList<Student> getStudentList() {
return studentList;
}

public String getGroupID() {
return groupID;
}

public int getSize() {
return size;
}
}
33 changes: 33 additions & 0 deletions src/main/java/org/codedifferently/cbtyson/data/GroupList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.codedifferently.cbtyson.data;

import java.util.ArrayList;
import java.util.List;

public class GroupList {

static ArrayList<Group> groups;

public static List<Group> GetGroups() {
return groups;
}

public static void AddGroup(Group group) {
groups.add(group);
}

public static void AddStudentToGroup(String groupID,Student student) {
for (Group group : groups) {
if(group.getGroupID().equals(groupID)) {
group.getStudentList().add(student);
}
}
}

public static void RemoveStudentFromGroup(String groupID, Student student) {
for (Group group : groups) {
if(group.getGroupID().equals(groupID)) {
group.getStudentList().remove(student);
}
}
}
}
45 changes: 45 additions & 0 deletions src/main/java/org/codedifferently/cbtyson/data/Student.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package org.codedifferently.cbtyson.data;

public class Student {

public String firstName;
public String lastName;
public String email;
public String studentID;
public int age;
public double gpa;


public Student(String firstName, String lastName, String email, String studentID, int age, double gpa) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
this.studentID = studentID;
this.age = age;
this.gpa = gpa;
}

public String getFirstName() {
return firstName;
}

public String getLastName() {
return lastName;
}

public int getAge() {
return age;
}

public String getEmail() {
return email;
}

public double getGpa() {
return gpa;
}

public String getStudentID() {
return studentID;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package org.codedifferently.cbtyson.helpers;
import java.util.Scanner;

public class InputHandler {

public static int handleIntegerInput() {
Scanner scan = new Scanner(System.in);
int scanInput = 0;
boolean validScanInput = false;
//While loop to make sure user puts in the correct input
while(!validScanInput) {
//Call Scanner methods
try {
//Scanner method to collect input
scanInput = scan.nextInt();
validScanInput = true;
}
catch (Exception e) {
//If user enters invalid input, the catch block will prevent errors.
System.out.println("Invalid input! Try typing a number instead of a String!");
scan.next();
}
}
return scanInput;
}

public static String handleStringInput() {
Scanner scan = new Scanner(System.in);
String scanInput = "";
boolean validScanInput = false;
//While loop to make sure user puts in the correct input
while(!validScanInput) {
//Call Scanner methods
try {
//Scanner method to collect input
scanInput = scan.nextLine();
validScanInput = true;
}
catch (Exception e) {
//If user enters invalid input, the catch block will prevent errors.
System.out.println("Invalid input! Try typing a valid String!");
scan.next();
}
}
return scanInput;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.codedifferently.cbtyson.menus;

public class AddGroupMenu {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.codedifferently.cbtyson.menus;

public class AddStudentMenu {
}
74 changes: 74 additions & 0 deletions src/main/java/org/codedifferently/cbtyson/menus/MainMenu.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package org.codedifferently.cbtyson.menus;

import org.codedifferently.cbtyson.data.Group;
import org.codedifferently.cbtyson.data.GroupList;
import org.codedifferently.cbtyson.data.Student;
import org.codedifferently.cbtyson.helpers.InputHandler;

import java.util.ArrayList;

public class MainMenu {

public void promptMainMenu() {
//Group-Differently
//Structured Group Maker

//generate default students
generateDefaultStudents();

//main loop for program
boolean inMainMenu = true;
while(inMainMenu) {
System.out.println("=============================================================");
System.out.println();
System.out.println("Welcome to Group Differently!");
System.out.println("Please take a moment to assign a new group, or add new students!");
System.out.println();
System.out.println("=============================================================");

System.out.println("1. Add new Student");
System.out.println("2. Generate Group");
System.out.println("3. View Students/Groups");
System.out.println("4. Remove Students from Group");
System.out.println("5. Exit");

int inputCode = InputHandler.handleIntegerInput();

switch(inputCode) {
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
System.out.println("Have a Nice Day!");
inMainMenu = false;
break;
}
}
}

//generates students, and adds them to a group. then adds them into the static groupList field.
void generateDefaultStudents() {
//Make new students
Student glenn = new Student("Glenn", "Tyson", "mrtyson@gmail.com", "31d13d31", 29, 3.6);
Student chris = new Student("Chris", "Bennett", "cbswag@gmail.com", "1920vfvw", 30, 2.0);
Student alex = new Student("Alex", "Trunzo", "vanyllagodzylla@gmail.com", "120-1f1f", 22, 4.0);
Student bobby = new Student("Bobby", "Money", "bigmoney@gmail.com", "19911-wfwefwe", 25, 3.56);

//List of students added to arrayList
ArrayList<Student> students1 = new ArrayList<>();
students1.add(glenn);
students1.add(chris);
students1.add(alex);
students1.add(bobby);

Group group = new Group("Vanylla Godzylla Band", "90121jofrv", 4, students1);

//Add group
GroupList.AddGroup(group);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.codedifferently.cbtyson.menus;

public class RemoveMenu {
}
4 changes: 4 additions & 0 deletions src/main/java/org/codedifferently/cbtyson/menus/ViewMenu.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.codedifferently.cbtyson.menus;

public class ViewMenu {
}