Initial Commit
This commit is contained in:
8
Source Code/Assignment2/.idea/.gitignore
generated
vendored
Normal file
8
Source Code/Assignment2/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/../../../../../:\JavaProjects\JavaYear1\Assignment2\.idea/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
25
Source Code/Assignment2/.idea/codeStyles/Project.xml
generated
Normal file
25
Source Code/Assignment2/.idea/codeStyles/Project.xml
generated
Normal file
@ -0,0 +1,25 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<JetCodeStyleSettings>
|
||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||
<value>
|
||||
<package name="java.util" alias="false" withSubpackages="false" />
|
||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||
<package name="io.ktor" alias="false" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||
<value>
|
||||
<package name="" alias="false" withSubpackages="true" />
|
||||
<package name="java" alias="false" withSubpackages="true" />
|
||||
<package name="javax" alias="false" withSubpackages="true" />
|
||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||
<package name="" alias="true" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
</JetCodeStyleSettings>
|
||||
<ScalaCodeStyleSettings>
|
||||
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
|
||||
</ScalaCodeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
5
Source Code/Assignment2/.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
Source Code/Assignment2/.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
6
Source Code/Assignment2/.idea/misc.xml
generated
Normal file
6
Source Code/Assignment2/.idea/misc.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
Source Code/Assignment2/.idea/modules.xml
generated
Normal file
8
Source Code/Assignment2/.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Assignment2.iml" filepath="$PROJECT_DIR$/Assignment2.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
11
Source Code/Assignment2/Assignment2.iml
Normal file
11
Source Code/Assignment2/Assignment2.iml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/info/ExampleFiles" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
BIN
Source Code/Assignment2/info/A2-StudentFiles.zip
Normal file
BIN
Source Code/Assignment2/info/A2-StudentFiles.zip
Normal file
Binary file not shown.
37
Source Code/Assignment2/info/A2-StudentFiles/Course.java
Normal file
37
Source Code/Assignment2/info/A2-StudentFiles/Course.java
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
This class represents a Course.
|
||||
@author Leah Bidlake
|
||||
*/
|
||||
|
||||
public class Course{
|
||||
|
||||
//Instance variables:
|
||||
//For each Course object, store its name, semester, year, and the
|
||||
//number of students enrolled in the course so far.
|
||||
private String name;
|
||||
private String semester;
|
||||
private int year;
|
||||
private int students;
|
||||
|
||||
|
||||
//The constructor creates a new Course object and initializes the
|
||||
//instance variables.
|
||||
public Course(String nameIn, String semesterIn, int yearIn){
|
||||
name = nameIn;
|
||||
semester = semesterIn;
|
||||
year = yearIn;
|
||||
students = 0; //no students have been added to the course
|
||||
}
|
||||
|
||||
//This is a method that we can call on a Course object
|
||||
//(Specifically, it is an accessor method). This method
|
||||
//creates and returns a String containing all the information
|
||||
//about the state of the object.
|
||||
public String toString(){
|
||||
return name +
|
||||
" offered " + semester +
|
||||
" " + year +
|
||||
" Students: " + students;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/**
|
||||
This is an example of a driver class; its purpose
|
||||
is to try out the Course class.
|
||||
@author Leah Bidlake
|
||||
*/
|
||||
|
||||
public class CourseDriver{
|
||||
|
||||
public static void main(String[] args){
|
||||
|
||||
//Create some Course objects
|
||||
Course course1 = new Course("CS1073", "Fall", 2020);
|
||||
Course course2 = new Course("CS1083", "Winter", 2021);
|
||||
Course course3 = new Course("MATH1013", "Summer", 2021);
|
||||
|
||||
|
||||
//Now I can print out my courses to confirm they
|
||||
//were created properly
|
||||
System.out.println("course1: " + course1.toString());
|
||||
System.out.println("course2: " + course2.toString());
|
||||
System.out.println("course3: " + course3.toString());
|
||||
|
||||
}
|
||||
|
||||
}
|
BIN
Source Code/Assignment2/info/CS1073-Assign2-F2020.pdf
Normal file
BIN
Source Code/Assignment2/info/CS1073-Assign2-F2020.pdf
Normal file
Binary file not shown.
BIN
Source Code/Assignment2/info/ExampleFiles/Course.class
Normal file
BIN
Source Code/Assignment2/info/ExampleFiles/Course.class
Normal file
Binary file not shown.
37
Source Code/Assignment2/info/ExampleFiles/Course.java
Normal file
37
Source Code/Assignment2/info/ExampleFiles/Course.java
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
This class represents a Course.
|
||||
@author Leah Bidlake
|
||||
*/
|
||||
|
||||
public class Course{
|
||||
|
||||
//Instance variables:
|
||||
//For each Course object, store its name, semester, year, and the
|
||||
//number of students enrolled in the course so far.
|
||||
private String name;
|
||||
private String semester;
|
||||
private int year;
|
||||
private int students;
|
||||
|
||||
|
||||
//The constructor creates a new Course object and initializes the
|
||||
//instance variables.
|
||||
public Course(String nameIn, String semesterIn, int yearIn){
|
||||
name = nameIn;
|
||||
semester = semesterIn;
|
||||
year = yearIn;
|
||||
students = 0; //no students have been added to the course
|
||||
}
|
||||
|
||||
//This is a method that we can call on a Course object
|
||||
//(Specifically, it is an accessor method). This method
|
||||
//creates and returns a String containing all the information
|
||||
//about the state of the object.
|
||||
public String toString(){
|
||||
return name +
|
||||
" offered " + semester +
|
||||
" " + year +
|
||||
" Students: " + students;
|
||||
}
|
||||
|
||||
}
|
BIN
Source Code/Assignment2/info/ExampleFiles/CourseDriver.class
Normal file
BIN
Source Code/Assignment2/info/ExampleFiles/CourseDriver.class
Normal file
Binary file not shown.
25
Source Code/Assignment2/info/ExampleFiles/CourseDriver.java
Normal file
25
Source Code/Assignment2/info/ExampleFiles/CourseDriver.java
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
This is an example of a driver class; its purpose
|
||||
is to try out the Course class.
|
||||
@author Leah Bidlake
|
||||
*/
|
||||
|
||||
public class CourseDriver{
|
||||
|
||||
public static void main(String[] args){
|
||||
|
||||
//Create some Course objects
|
||||
Course course1 = new Course("CS1073", "Fall", 2020);
|
||||
Course course2 = new Course("CS1083", "Winter", 2021);
|
||||
Course course3 = new Course("MATH1013", "Summer", 2021);
|
||||
|
||||
|
||||
//Now I can print out my courses to confirm they
|
||||
//were created properly
|
||||
System.out.println("course1: " + course1.toString());
|
||||
System.out.println("course2: " + course2.toString());
|
||||
System.out.println("course3: " + course3.toString());
|
||||
|
||||
}
|
||||
|
||||
}
|
3
Source Code/Assignment2/info/ExampleFiles/Output.txt
Normal file
3
Source Code/Assignment2/info/ExampleFiles/Output.txt
Normal file
@ -0,0 +1,3 @@
|
||||
course1: CS1073 offered Fall 2020 Students: 0
|
||||
course2: CS1083 offered Winter 2021 Students: 0
|
||||
course3: MATH1013 offered Summer 2021 Students: 0
|
Binary file not shown.
BIN
Source Code/Assignment2/materials/IsaacShoebottom_As2_Report.pdf
Normal file
BIN
Source Code/Assignment2/materials/IsaacShoebottom_As2_Report.pdf
Normal file
Binary file not shown.
BIN
Source Code/Assignment2/materials/Part2.docx
Normal file
BIN
Source Code/Assignment2/materials/Part2.docx
Normal file
Binary file not shown.
BIN
Source Code/Assignment2/out/production/Assignment2/Course.class
Normal file
BIN
Source Code/Assignment2/out/production/Assignment2/Course.class
Normal file
Binary file not shown.
Binary file not shown.
40
Source Code/Assignment2/src/Course.java
Normal file
40
Source Code/Assignment2/src/Course.java
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
This class represents a Course.
|
||||
@author Leah Bidlake
|
||||
@author Isaac Shoebottom (3429069)
|
||||
*/
|
||||
|
||||
public class Course{
|
||||
|
||||
//Instance variables:
|
||||
//For each Course object, store its name, semester, year, and the
|
||||
//number of students enrolled in the course so far.
|
||||
private final String name;
|
||||
private final String semester;
|
||||
private final String instructor;
|
||||
private final int year;
|
||||
private int students;
|
||||
|
||||
|
||||
//The constructor creates a new Course object and initializes the
|
||||
//instance variables.
|
||||
public Course(String nameIn, String semesterIn, String instructorIn, int yearIn){
|
||||
this.name = nameIn;
|
||||
this.semester = semesterIn;
|
||||
this.instructor = instructorIn;
|
||||
this.year = yearIn;
|
||||
this.students = 0; //no students have been added to the course
|
||||
}
|
||||
|
||||
//This is a method that we can call on a Course object
|
||||
//(Specifically, it is an accessor method). This method
|
||||
//creates and returns a String containing all the information
|
||||
//about the state of the object.
|
||||
public String Output(){ //Maybe don't overwrite the base "toString method???"
|
||||
return name + " offered " + semester + " " + year + ". Taught By: " + instructor + ". Students: " + students;
|
||||
}
|
||||
|
||||
public void addStudents(int students) {
|
||||
this.students += students;
|
||||
}
|
||||
}
|
45
Source Code/Assignment2/src/CourseDriver.java
Normal file
45
Source Code/Assignment2/src/CourseDriver.java
Normal file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
This is an example of a driver class; its purpose
|
||||
is to try out the Course class.
|
||||
@author Leah Bidlake
|
||||
@author Isaac Shoebottom (3429069)
|
||||
*/
|
||||
|
||||
public class CourseDriver{
|
||||
|
||||
public static void main(String[] args){
|
||||
|
||||
//Create some Course objects
|
||||
Course course1 = new Course("CS1073", "Fall", "Mr. Don Clement",2020);
|
||||
Course course2 = new Course("CS1083", "Winter", "Dr. Harvey Ingrid",2021);
|
||||
Course course3 = new Course("MATH1013", "Summer", "Mrs. Lee Smith" ,2021);
|
||||
Course course4 = new Course("ENG1104", "Fall", "Ms. Kate Free", 2022);
|
||||
|
||||
/* Add the appropriate statements to record the fact that 23 students have
|
||||
been added to CS1073, 17 students have been added to CS1083, and 31
|
||||
students have been added to MATH1013. Then, provide another
|
||||
statement to record the fact that 14 more students have been added to
|
||||
CS1073. Position these four statements after the objects are created and
|
||||
before they are printed out. */
|
||||
course1.addStudents(23);
|
||||
course2.addStudents(17);
|
||||
course3.addStudents(31);
|
||||
course1.addStudents(14);
|
||||
|
||||
System.out.println("23 students have been added to CS1073");
|
||||
System.out.println("17 students have been added to CS1083");
|
||||
System.out.println("31 students have been added to MATH1013");
|
||||
System.out.println("14 students have been added to CS1073");
|
||||
|
||||
|
||||
//Now I can print out my courses to confirm they
|
||||
//were created properly
|
||||
System.out.println("course1: " + course1.Output());
|
||||
System.out.println("course2: " + course2.Output());
|
||||
System.out.println("course3: " + course3.Output());
|
||||
System.out.println("course4: " + course4.Output());
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user