Skip to content

Commit

Permalink
Modified 3 files
Browse files Browse the repository at this point in the history
Started finalizing project. Needs more work.
  • Loading branch information
CarlosFMeneses committed Mar 13, 2019
1 parent 7b4a6de commit 882fcf0
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 19 deletions.
43 changes: 37 additions & 6 deletions src/classroomController/ClassController.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,52 @@
/**
* @author carlosfmeneses
* ClassController.java
* created 3/8/2019 | updated 3/10/2019
* created 3/8/2019 | updated 3/12/2019
*/

class ClassController {

static int studentsMax = 10;
static int studentsQuantity = 0;

static int lightsMax = 3;
static int lightsQuantity = 0;

/**
* @param args
*/
Classroom currentClassroom = new Classroom(0, 0);
static Classroom currentClassroom = new Classroom(studentsMax, studentsQuantity, lightsMax, lightsQuantity);

public static void main(String[] args) {
menu();
}

private static void menu() {
studentsQuantity = currentClassroom.getStudentsQuantity();
lightsQuantity = currentClassroom.getLightsQuantity();

System.out.print("Students: " + studentsQuantity + "/" + studentsMax
+ "\n"
+ "Lights: " + lightsQuantity + "/" + lightsMax
+ "\n\n"
+ "(A) Add students \n"
+ "(R) Remove students \n"
+ "(L) Lights on \n"
+ "(O) Lights off \n"
+ "\n");
commandSelection();
}

private static void commandSelection() {
System.out.print("Enter command: ");
String command = Reader.getMyString();
System.out.println("You entered: " + command);
String userCommand = Reader.getMyString();
System.out.println("Your command: " + userCommand + "\n");
commandInteger();
}

private static void commandInteger() {
System.out.print("Enter quantity: ");
int userQuantity = Reader.getMyInt();
System.out.println("Your quantity: " + userQuantity);
}

}
41 changes: 29 additions & 12 deletions src/classroomController/Classroom.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,61 @@
/**
* @author carlosfmeneses
* ClassController.java
* created 3/10/2019 | updated 3/10/2019
* created 3/10/2019 | updated 3/12/2019
*/

class Classroom {
private int studentsMax;
private int studentQuantity;
private int lightQuantity;

Classroom (int studentInitiate, int lightInitiate) {

private int lightsMax;
private int lightsQuantity;

Classroom(int studentsMaxInitiate, int studentInitiate, int lightsMaxInitiate, int lightInitiate) {
studentsMax = studentsMaxInitiate;
studentQuantity = studentInitiate;
lightQuantity = lightInitiate;
lightsMax = lightsMaxInitiate;
lightsQuantity = lightInitiate;
}

/**
* @return the studentQuantity
*/
public int getStudentQuantity() {
public int getStudentsQuantity() {
return studentQuantity;
}

/**
* @param studentQuantity the studentQuantity to set
*/
public void setStudentQuantity(int studentQuantity) {
this.studentQuantity = studentQuantity;
public void setStudentsQuantity(int studentQuantity) {
if (studentQuantity < 0) {
this.studentQuantity = 0;
} else if (studentQuantity > studentsMax) {
this.studentQuantity = studentsMax;
} else {
this.studentQuantity = studentQuantity;
}
}

/**
* @return the lightQuantity
*/
public int getLightQuantity() {
return lightQuantity;
public int getLightsQuantity() {
return lightsQuantity;
}

/**
* @param lightQuantity the lightQuantity to set
*/
public void setLightQuantity(int lightQuantity) {
this.lightQuantity = lightQuantity;
public void setLightsQuantity(int lightsQuantity) {
if (lightsQuantity < 0) {
this.lightsQuantity = 0;
} else if (lightsQuantity > lightsMax) {
this.lightsQuantity = lightsMax;
} else {
this.lightsQuantity = lightsQuantity;
}
}

}
11 changes: 10 additions & 1 deletion src/classroomController/Reader.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
/**
* @author carlosfmeneses
* ClassController.java
* created 3/11/2019 | updated 3/11/2019
* created 3/11/2019 | updated 3/12/2019
*/

class Reader {
static private Scanner myScanner = new Scanner(System.in);
static private String myString = "test";
static private int myInt = 0;

/**
* @param args
Expand All @@ -29,6 +30,14 @@ static public String getMyString() {
return myString;
}

/**
* @return the myInt
*/
static public int getMyInt() {
myInt = myScanner.nextInt();
return myInt;
}

/**
* @param myString the myString to set
*/
Expand Down

0 comments on commit 882fcf0

Please sign in to comment.