Initial Commit
This commit is contained in:
commit
bdcf6d3e1c
10
Source Code/Assignment1/.idea/.gitignore
vendored
Normal file
10
Source Code/Assignment1/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/../../../../../:\JavaProjects\JavaYear1\Assignment1\.idea/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Zeppelin ignored files
|
||||||
|
/ZeppelinRemoteNotebooks/
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
25
Source Code/Assignment1/.idea/codeStyles/Project.xml
Normal file
25
Source Code/Assignment1/.idea/codeStyles/Project.xml
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>
|
@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||||
|
</state>
|
||||||
|
</component>
|
6
Source Code/Assignment1/.idea/discord.xml
Normal file
6
Source Code/Assignment1/.idea/discord.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DiscordProjectSettings">
|
||||||
|
<option name="show" value="PROJECT_FILES" />
|
||||||
|
</component>
|
||||||
|
</project>
|
6
Source Code/Assignment1/.idea/misc.xml
Normal file
6
Source Code/Assignment1/.idea/misc.xml
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/Assignment1/.idea/modules.xml
Normal file
8
Source Code/Assignment1/.idea/modules.xml
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$/Assignment1.iml" filepath="$PROJECT_DIR$/Assignment1.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
10
Source Code/Assignment1/.idea/runConfigurations.xml
Normal file
10
Source Code/Assignment1/.idea/runConfigurations.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RunConfigurationProducerService">
|
||||||
|
<option name="ignoredProducers">
|
||||||
|
<set>
|
||||||
|
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
124
Source Code/Assignment1/.idea/uiDesigner.xml
Normal file
124
Source Code/Assignment1/.idea/uiDesigner.xml
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
11
Source Code/Assignment1/Assignment1.iml
Normal file
11
Source Code/Assignment1/Assignment1.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">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
Binary file not shown.
BIN
Source Code/Assignment1/materials/IsaacShoebottom_As1_Report.pdf
Normal file
BIN
Source Code/Assignment1/materials/IsaacShoebottom_As1_Report.pdf
Normal file
Binary file not shown.
BIN
Source Code/Assignment1/materials/Part1.docx
Normal file
BIN
Source Code/Assignment1/materials/Part1.docx
Normal file
Binary file not shown.
BIN
Source Code/Assignment1/materials/Question2.png
Normal file
BIN
Source Code/Assignment1/materials/Question2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
Source Code/Assignment1/materials/Question3.png
Normal file
BIN
Source Code/Assignment1/materials/Question3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
Source Code/Assignment1/materials/Question4.png
Normal file
BIN
Source Code/Assignment1/materials/Question4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
13
Source Code/Assignment1/src/InputAndOutput.java
Normal file
13
Source Code/Assignment1/src/InputAndOutput.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/** @author Isaac Ray Shoebottom (3429069) **/
|
||||||
|
import java.util.Scanner;
|
||||||
|
public class InputAndOutput{
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner sc = new Scanner(System.in);
|
||||||
|
System.out.println("My name is TOM. What is your name?");
|
||||||
|
String userName = sc.nextLine();
|
||||||
|
System.out.println("Pleased to meet you, " + userName);
|
||||||
|
System.out.println("In which program are you enrolled?");
|
||||||
|
String userEnrollment = sc.nextLine();
|
||||||
|
System.out.println("Oh? So you're " + userName + ", currently enrolled in " + userEnrollment + '!');
|
||||||
|
}
|
||||||
|
}
|
6
Source Code/Assignment1/src/MyFirstJavaProgram.java
Normal file
6
Source Code/Assignment1/src/MyFirstJavaProgram.java
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/** @author Isaac Ray Shoebottom (3429069) **/
|
||||||
|
public class MyFirstJavaProgram {
|
||||||
|
public static void main(String[]args) {
|
||||||
|
System.out.println("Hello World");
|
||||||
|
}
|
||||||
|
}
|
14
Source Code/Assignment1/src/MyInitials.java
Normal file
14
Source Code/Assignment1/src/MyInitials.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/** @author Isaac Ray Shoebottom (3429069) **/
|
||||||
|
public class MyInitials {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("######### #### ");
|
||||||
|
System.out.println(" # ## ");
|
||||||
|
System.out.println(" # # ");
|
||||||
|
System.out.println(" # ## ");
|
||||||
|
System.out.println(" # ### ");
|
||||||
|
System.out.println(" # # ");
|
||||||
|
System.out.println(" # # ");
|
||||||
|
System.out.println(" # ## ");
|
||||||
|
System.out.println("######### #### ");
|
||||||
|
}
|
||||||
|
}
|
8
Source Code/Assignment10/.idea/.gitignore
vendored
Normal file
8
Source Code/Assignment10/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/../../../../../../:\ProgrammingProjects\JavaProjects\JavaYear1\Assignment10\.idea/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
25
Source Code/Assignment10/.idea/codeStyles/Project.xml
Normal file
25
Source Code/Assignment10/.idea/codeStyles/Project.xml
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>
|
@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||||
|
</state>
|
||||||
|
</component>
|
6
Source Code/Assignment10/.idea/discord.xml
Normal file
6
Source Code/Assignment10/.idea/discord.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DiscordProjectSettings">
|
||||||
|
<option name="show" value="PROJECT" />
|
||||||
|
</component>
|
||||||
|
</project>
|
6
Source Code/Assignment10/.idea/misc.xml
Normal file
6
Source Code/Assignment10/.idea/misc.xml
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/Assignment10/.idea/modules.xml
Normal file
8
Source Code/Assignment10/.idea/modules.xml
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$/Assignment10.iml" filepath="$PROJECT_DIR$/Assignment10.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
11
Source Code/Assignment10/Assignment10.iml
Normal file
11
Source Code/Assignment10/Assignment10.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">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
Binary file not shown.
Binary file not shown.
109
Source Code/Assignment10/src/Converter.java
Normal file
109
Source Code/Assignment10/src/Converter.java
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/**
|
||||||
|
* Class containing the methods for conversion
|
||||||
|
* @author Isaac Shoebottom (3429069)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Converter {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert hexadecimal to base 10
|
||||||
|
* @param hex String containing the hex digits
|
||||||
|
* @return returns the decimal value
|
||||||
|
*/
|
||||||
|
static long hex2Decimal(String hex) {
|
||||||
|
String hexChars = "0123456789ABCDEF";
|
||||||
|
hex = hex.toUpperCase();
|
||||||
|
long decimal = 0;
|
||||||
|
int intermediaryValue;
|
||||||
|
char index;
|
||||||
|
for (int i = hex.length(), p = 0; i != 0; i--, p++) {
|
||||||
|
index = hex.charAt(i-1);
|
||||||
|
intermediaryValue = hexChars.indexOf(index);
|
||||||
|
if (intermediaryValue == -1)
|
||||||
|
return -1;
|
||||||
|
decimal = decimal + intermediaryValue*(int)(Math.pow(16, p));
|
||||||
|
}
|
||||||
|
return decimal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the english text to the encoded text
|
||||||
|
* @param english String containing standard english
|
||||||
|
* @return Returns encoded text
|
||||||
|
*/
|
||||||
|
static String english2Encrypted(String english) {
|
||||||
|
english = english.toUpperCase();
|
||||||
|
if (english.length() > 1) {
|
||||||
|
english = swapFirstAndLastLettersInString(english);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < english.length(); i++) {
|
||||||
|
char index = english.charAt(i);
|
||||||
|
switch (index) {
|
||||||
|
case 'E':
|
||||||
|
english = replaceInString(english, i, "A");
|
||||||
|
break;
|
||||||
|
case 'A':
|
||||||
|
english = replaceInString(english, i, "E");
|
||||||
|
break;
|
||||||
|
case 'O':
|
||||||
|
english = replaceInString(english, i, "I");
|
||||||
|
break;
|
||||||
|
case 'I':
|
||||||
|
english = replaceInString(english, i, "O");
|
||||||
|
break;
|
||||||
|
case 'U':
|
||||||
|
english = replaceInString(english, i, "Y");
|
||||||
|
break;
|
||||||
|
case 'Y':
|
||||||
|
english = replaceInString(english, i, "U");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return english;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace a letter in a string
|
||||||
|
* @param str String to be modified
|
||||||
|
* @param index The character's index to be replaced
|
||||||
|
* @param replace The string that will be replacing the character
|
||||||
|
* @return The string with the string replaced
|
||||||
|
*/
|
||||||
|
private static String replaceInString(String str, int index, String replace){
|
||||||
|
return str.substring(0, index) + replace + str.substring(index+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Swaps the first and letters in every word in a string
|
||||||
|
* @param str The string to be swapped
|
||||||
|
* @return The string with letters swapped
|
||||||
|
*/
|
||||||
|
private static String swapFirstAndLastLettersInString(String str) {
|
||||||
|
StringBuilder output = new StringBuilder();
|
||||||
|
String[] splitStr = str.trim().split("\\s+");
|
||||||
|
|
||||||
|
for(int i = 0; i < splitStr.length; i++) {
|
||||||
|
if (splitStr[i].length() != 1) {
|
||||||
|
splitStr[i] = swapFirstAndLastLetterFromWord(splitStr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
output.append(" ").append(splitStr[i]);
|
||||||
|
if (i == 0) {
|
||||||
|
output = new StringBuilder(splitStr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return output.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to swap the first and last letters in a word
|
||||||
|
* @param str The string to be swapped
|
||||||
|
* @return The swapped string
|
||||||
|
*/
|
||||||
|
private static String swapFirstAndLastLetterFromWord(String str) {
|
||||||
|
return str.charAt(str.length() - 1) + str.substring(1, str.length() - 1) + str.charAt(0);
|
||||||
|
}
|
||||||
|
}
|
65
Source Code/Assignment10/src/Driver.java
Normal file
65
Source Code/Assignment10/src/Driver.java
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.layout.FlowPane;
|
||||||
|
import javafx.scene.text.Text;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GUI Class
|
||||||
|
* @author Isaac Shoebottom (3429069)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Driver extends Application {
|
||||||
|
FlowPane flowPane = new FlowPane();
|
||||||
|
Text textInstructions = new Text("Enter a hex value or English word or phrase:");
|
||||||
|
TextField textFieldMain = new TextField("");
|
||||||
|
Button buttonH2D= new Button("Hex To Decimal");
|
||||||
|
Button buttonE2E = new Button("English to Encrypted");
|
||||||
|
Text textResult = new Text("Welcome to the Converter App!");
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage) {
|
||||||
|
primaryStage.setTitle("Package Calculator");
|
||||||
|
flowPane.setPadding(new Insets(10, 10, 10, 10));
|
||||||
|
flowPane.setHgap(10);
|
||||||
|
flowPane.setVgap(15);
|
||||||
|
flowPane.setAlignment(Pos.CENTER);
|
||||||
|
|
||||||
|
buttonH2D.setOnAction(this::calculateHex);
|
||||||
|
buttonE2E.setOnAction(this::calculateEncrypted);
|
||||||
|
|
||||||
|
textFieldMain.setPrefWidth(150);
|
||||||
|
|
||||||
|
flowPane.getChildren().addAll(
|
||||||
|
textInstructions,
|
||||||
|
textFieldMain,
|
||||||
|
buttonH2D, buttonE2E,
|
||||||
|
textResult
|
||||||
|
);
|
||||||
|
|
||||||
|
primaryStage.setScene(new Scene(flowPane, 250, 200));
|
||||||
|
primaryStage.setResizable(false);
|
||||||
|
primaryStage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void calculateHex(ActionEvent actionEvent) {
|
||||||
|
long input = Converter.hex2Decimal(textFieldMain.getText());
|
||||||
|
if (input == -1) {
|
||||||
|
textResult.setText("Invalid input");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
textResult.setText(Long.toString(input));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void calculateEncrypted(ActionEvent actionEvent) {
|
||||||
|
textResult.setText(Converter.english2Encrypted(textFieldMain.getText()));
|
||||||
|
}
|
||||||
|
}
|
8
Source Code/Assignment11/.idea/.gitignore
vendored
Normal file
8
Source Code/Assignment11/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/../../../../../../:\ProgrammingProjects\JavaProjects\JavaYear1\Assignment11\.idea/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
7
Source Code/Assignment11/.idea/codeStyles/Project.xml
Normal file
7
Source Code/Assignment11/.idea/codeStyles/Project.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<ScalaCodeStyleSettings>
|
||||||
|
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
|
||||||
|
</ScalaCodeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||||
|
</state>
|
||||||
|
</component>
|
1
Source Code/Assignment11/.idea/description.html
Normal file
1
Source Code/Assignment11/.idea/description.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html>Simple <b>Java</b> application that includes a class with <code>main()</code> method</html>
|
6
Source Code/Assignment11/.idea/discord.xml
Normal file
6
Source Code/Assignment11/.idea/discord.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DiscordProjectSettings">
|
||||||
|
<option name="show" value="PROJECT" />
|
||||||
|
</component>
|
||||||
|
</project>
|
6
Source Code/Assignment11/.idea/encodings.xml
Normal file
6
Source Code/Assignment11/.idea/encodings.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="PROJECT" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,10 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||||
|
<Languages>
|
||||||
|
<language minSize="133" name="Java" />
|
||||||
|
</Languages>
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
9
Source Code/Assignment11/.idea/misc.xml
Normal file
9
Source Code/Assignment11/.idea/misc.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectKey">
|
||||||
|
<option name="state" value="project://e2804f05-5315-4fc6-a121-c522a6c26470" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
Source Code/Assignment11/.idea/modules.xml
Normal file
8
Source Code/Assignment11/.idea/modules.xml
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$/Assignment11.iml" filepath="$PROJECT_DIR$/Assignment11.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
3
Source Code/Assignment11/.idea/project-template.xml
Normal file
3
Source Code/Assignment11/.idea/project-template.xml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<template>
|
||||||
|
<input-field default="com.company">IJ_BASE_PACKAGE</input-field>
|
||||||
|
</template>
|
11
Source Code/Assignment11/Assignment11.iml
Normal file
11
Source Code/Assignment11/Assignment11.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">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
50
Source Code/Assignment11/src/ClassGrades.java
Normal file
50
Source Code/Assignment11/src/ClassGrades.java
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple test stats
|
||||||
|
* @author Isaac Shoebottom (3429069)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ClassGrades {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner scan = new Scanner(System.in);
|
||||||
|
long testScore;
|
||||||
|
long numberOfA = 0;
|
||||||
|
long numberOfB = 0;
|
||||||
|
long numberOfC = 0;
|
||||||
|
long numberOfD = 0;
|
||||||
|
long numberOfF = 0;
|
||||||
|
do {
|
||||||
|
System.out.print("Enter test score: ");
|
||||||
|
testScore = scan.nextLong();
|
||||||
|
|
||||||
|
if (testScore > 100) {
|
||||||
|
System.out.println("Please enter a test score within the range 0-100");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (testScore >= 85) {
|
||||||
|
numberOfA++;
|
||||||
|
}
|
||||||
|
else if (testScore >= 70) {
|
||||||
|
numberOfB++;
|
||||||
|
}
|
||||||
|
else if (testScore >= 55) {
|
||||||
|
numberOfC++;
|
||||||
|
}
|
||||||
|
else if (testScore >= 45) {
|
||||||
|
numberOfD++;
|
||||||
|
}
|
||||||
|
else if (testScore >= 0) {
|
||||||
|
numberOfF++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (testScore >= 0);
|
||||||
|
|
||||||
|
System.out.println("Number of A's: " + numberOfA);
|
||||||
|
System.out.println("Number of B's: " + numberOfB);
|
||||||
|
System.out.println("Number of C's: " + numberOfC);
|
||||||
|
System.out.println("Number of D's: " + numberOfD);
|
||||||
|
System.out.println("Number of F's: " + numberOfF);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
74
Source Code/Assignment11/src/ClassGradesHistogram.java
Normal file
74
Source Code/Assignment11/src/ClassGradesHistogram.java
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sideways histogram for tests
|
||||||
|
* @author Isaac Shoebottom (3429069)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ClassGradesHistogram {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner scan = new Scanner(System.in);
|
||||||
|
long testScore;
|
||||||
|
long numberOfA = 0;
|
||||||
|
long numberOfB = 0;
|
||||||
|
long numberOfC = 0;
|
||||||
|
long numberOfD = 0;
|
||||||
|
long numberOfF = 0;
|
||||||
|
do {
|
||||||
|
System.out.print("Enter test score: ");
|
||||||
|
testScore = scan.nextLong();
|
||||||
|
|
||||||
|
if (testScore > 100) {
|
||||||
|
System.out.println("Please enter a test score within the range 0-100");
|
||||||
|
} else {
|
||||||
|
if (testScore >= 85) {
|
||||||
|
numberOfA++;
|
||||||
|
} else if (testScore >= 70) {
|
||||||
|
numberOfB++;
|
||||||
|
} else if (testScore >= 55) {
|
||||||
|
numberOfC++;
|
||||||
|
} else if (testScore >= 45) {
|
||||||
|
numberOfD++;
|
||||||
|
} else if (testScore >= 0) {
|
||||||
|
numberOfF++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (testScore >= 0);
|
||||||
|
|
||||||
|
System.out.println("Scores");
|
||||||
|
System.out.print("A\t\t|");
|
||||||
|
while (numberOfA > 0) {
|
||||||
|
System.out.print('*');
|
||||||
|
numberOfA--;
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
System.out.print("B\t\t|");
|
||||||
|
while (numberOfB > 0) {
|
||||||
|
System.out.print('*');
|
||||||
|
numberOfB--;
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
System.out.print("C\t\t|");
|
||||||
|
while (numberOfC > 0) {
|
||||||
|
System.out.print('*');
|
||||||
|
numberOfC--;
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
System.out.print("D\t\t|");
|
||||||
|
while (numberOfD > 0) {
|
||||||
|
System.out.print('*');
|
||||||
|
numberOfD--;
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
System.out.print("F\t\t|");
|
||||||
|
while (numberOfF > 0) {
|
||||||
|
System.out.print('*');
|
||||||
|
numberOfF--;
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
System.out.println("\t\t" + "===============================");
|
||||||
|
System.out.println("\t\t" + "+ + + +");
|
||||||
|
System.out.println("\t\t" + "0 10 20 30");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vertical histogram for tests
|
||||||
|
* @author Isaac Shoebottom (3429069)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ClassGradesHistogramVertical {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner scan = new Scanner(System.in);
|
||||||
|
long testScore;
|
||||||
|
long numberOfA = 0;
|
||||||
|
long numberOfB = 0;
|
||||||
|
long numberOfC = 0;
|
||||||
|
long numberOfD = 0;
|
||||||
|
long numberOfF = 0;
|
||||||
|
do {
|
||||||
|
System.out.print("Enter test score: ");
|
||||||
|
testScore = scan.nextLong();
|
||||||
|
|
||||||
|
if (testScore > 100) {
|
||||||
|
System.out.println("Please enter a test score within the range 0-100");
|
||||||
|
} else {
|
||||||
|
if (testScore >= 85) {
|
||||||
|
numberOfA++;
|
||||||
|
} else if (testScore >= 70) {
|
||||||
|
numberOfB++;
|
||||||
|
} else if (testScore >= 55) {
|
||||||
|
numberOfC++;
|
||||||
|
} else if (testScore >= 45) {
|
||||||
|
numberOfD++;
|
||||||
|
} else if (testScore >= 0) {
|
||||||
|
numberOfF++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (testScore >= 0);
|
||||||
|
|
||||||
|
for (int i = 30; i > 0; i--) {
|
||||||
|
if (i == 30 | i == 20 | i == 10)
|
||||||
|
System.out.print(i+ "+");
|
||||||
|
System.out.print("\t| ");
|
||||||
|
if (numberOfA >= i) {
|
||||||
|
System.out.print('*');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.print(' ');
|
||||||
|
}
|
||||||
|
System.out.print(' ');
|
||||||
|
if (numberOfB >= i) {
|
||||||
|
System.out.print('*');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.print(' ');
|
||||||
|
}
|
||||||
|
System.out.print(' ');
|
||||||
|
if (numberOfC >= i) {
|
||||||
|
System.out.print('*');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.print(' ');
|
||||||
|
}
|
||||||
|
System.out.print(' ');
|
||||||
|
if (numberOfD >= i) {
|
||||||
|
System.out.print('*');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.print(' ');
|
||||||
|
}
|
||||||
|
System.out.print(' ');
|
||||||
|
if (numberOfF >= i) {
|
||||||
|
System.out.print('*');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.print(' ');
|
||||||
|
}
|
||||||
|
System.out.print(' ');
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
System.out.println("0+\t===========");
|
||||||
|
System.out.println("\t A B C D F");
|
||||||
|
}
|
||||||
|
}
|
67
Source Code/Assignment11/src/IntArrayUtil.java
Normal file
67
Source Code/Assignment11/src/IntArrayUtil.java
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/**
|
||||||
|
* Array utils for ints
|
||||||
|
* @author Isaac Shoebottom (3429069)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class IntArrayUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends an array to another array
|
||||||
|
* @param arrA First array in append
|
||||||
|
* @param arrB Second array in append
|
||||||
|
* @return Appended array
|
||||||
|
*/
|
||||||
|
public static int[] append (int[] arrA, int[] arrB) {
|
||||||
|
int appendedLength = arrA.length + arrB.length;
|
||||||
|
int[] appended = new int[appendedLength];
|
||||||
|
for(int i = 0; i < arrA.length; i++) {
|
||||||
|
appended[i] = arrA[i];
|
||||||
|
}
|
||||||
|
for(int i = 0; i < arrB.length; i++) {
|
||||||
|
appended[i + arrA.length] = arrB[i];
|
||||||
|
}
|
||||||
|
return appended;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the order of elements in a string
|
||||||
|
* @param arr The array to be reversed
|
||||||
|
* @return The reversed array
|
||||||
|
*/
|
||||||
|
public static int[] reverse (int[] arr) {
|
||||||
|
int[] reversed = new int[arr.length];
|
||||||
|
for(int i =0; i<arr.length; i++ ) {
|
||||||
|
reversed[i] = arr[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < arr.length/2; i++) {
|
||||||
|
int temp = reversed[i];
|
||||||
|
reversed[i] = arr[(arr.length-1) - i];
|
||||||
|
reversed[(arr.length-1) - i] = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return reversed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subtracts every odd index from a string from every even index
|
||||||
|
* @param arr The array to perform math on
|
||||||
|
* @return The alternating sum of the array
|
||||||
|
*/
|
||||||
|
public static int alternatingSum (int[] arr) {
|
||||||
|
|
||||||
|
int positives = 0;
|
||||||
|
int negatives = 0;
|
||||||
|
boolean isPos = true;
|
||||||
|
for (int j : arr)
|
||||||
|
if (isPos) {
|
||||||
|
positives += j;
|
||||||
|
isPos = false;
|
||||||
|
} else {
|
||||||
|
negatives += j;
|
||||||
|
isPos = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return positives-negatives;
|
||||||
|
}
|
||||||
|
}
|
21
Source Code/Assignment11/src/IntArrayUtilDriver.java
Normal file
21
Source Code/Assignment11/src/IntArrayUtilDriver.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class IntArrayUtilDriver {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
int[] array1 = {1, 4 ,9, 16};
|
||||||
|
int[] array2 = {9, 7, 4, 9 ,11};
|
||||||
|
|
||||||
|
int[] array3 = IntArrayUtil.append(array1, array2);
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("These are the original strings");
|
||||||
|
System.out.println(Arrays.toString(array1));
|
||||||
|
System.out.println(Arrays.toString(array2));
|
||||||
|
System.out.println(Arrays.toString(array3));
|
||||||
|
|
||||||
|
System.out.println("These are the modified strings");
|
||||||
|
System.out.println(Arrays.toString(IntArrayUtil.append(array1, array2)));
|
||||||
|
System.out.println(Arrays.toString(IntArrayUtil.reverse(array3)));
|
||||||
|
System.out.println(IntArrayUtil.alternatingSum(array3));
|
||||||
|
}
|
||||||
|
}
|
11
Source Code/Assignment11/src/Pattern.java
Normal file
11
Source Code/Assignment11/src/Pattern.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
public class Pattern {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
for (int i = 10; i > 0; i--) {
|
||||||
|
for (int j = 1; j <= i; j++) {
|
||||||
|
System.out.print('*');
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
Source Code/Assignment11/src/PatternInverted.java
Normal file
19
Source Code/Assignment11/src/PatternInverted.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Inverted Stairs
|
||||||
|
* @author Isaac Shoebottom (3429069)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PatternInverted {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
for (int i = 1; i < 10; i++) {
|
||||||
|
for (int a = 9; a > i; a--) {
|
||||||
|
System.out.print(' ');
|
||||||
|
}
|
||||||
|
for (int j = 1; j <= i; j++) {
|
||||||
|
System.out.print('*');
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
Source Code/Assignment12/.idea/.gitignore
vendored
Normal file
8
Source Code/Assignment12/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/../../../../../../:\ProgrammingProjects\JavaProjects\JavaYear1\Assignment12\.idea/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
7
Source Code/Assignment12/.idea/codeStyles/Project.xml
Normal file
7
Source Code/Assignment12/.idea/codeStyles/Project.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<ScalaCodeStyleSettings>
|
||||||
|
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
|
||||||
|
</ScalaCodeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||||
|
</state>
|
||||||
|
</component>
|
6
Source Code/Assignment12/.idea/discord.xml
Normal file
6
Source Code/Assignment12/.idea/discord.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DiscordProjectSettings">
|
||||||
|
<option name="show" value="PROJECT" />
|
||||||
|
</component>
|
||||||
|
</project>
|
6
Source Code/Assignment12/.idea/misc.xml
Normal file
6
Source Code/Assignment12/.idea/misc.xml
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/Assignment12/.idea/modules.xml
Normal file
8
Source Code/Assignment12/.idea/modules.xml
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$/Assignment12.iml" filepath="$PROJECT_DIR$/Assignment12.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
12
Source Code/Assignment12/Assignment12.iml
Normal file
12
Source Code/Assignment12/Assignment12.iml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/resource" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
Binary file not shown.
13
Source Code/Assignment12/resource/cypherText.in
Normal file
13
Source Code/Assignment12/resource/cypherText.in
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
5
|
||||||
|
rrrcfieeeindtsndedogxceht
|
||||||
|
3
|
||||||
|
kcnanaehrduowahtrelilngaaxyttnipsivofct
|
||||||
|
7
|
||||||
|
mehnteeoumtaotpelunosisrcinmnozbozktageshsoeorlrpeowtnuo
|
||||||
|
4
|
||||||
|
xdutenkyeevnotomhooxxnyioweuoerymessngot
|
||||||
|
6
|
||||||
|
xnodithbonttchonyecneieejplmaompilro
|
||||||
|
2
|
||||||
|
aoerniewlltnroiryounfmawibeargadct
|
||||||
|
0
|
73
Source Code/Assignment12/src/Decoder.java
Normal file
73
Source Code/Assignment12/src/Decoder.java
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decodes encrypted text in a specific format
|
||||||
|
* @author Isaac Shoebottom (3429069)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Decoder {
|
||||||
|
public static void main(String[] args) throws FileNotFoundException {
|
||||||
|
|
||||||
|
Scanner scanFile = new Scanner(new File(args[0]));
|
||||||
|
int cycleCount = 0;
|
||||||
|
|
||||||
|
scanFile.useDelimiter("\\A");
|
||||||
|
String in = scanFile.next();
|
||||||
|
|
||||||
|
String[] codes = in.split("\\r?\\n");
|
||||||
|
|
||||||
|
for (String i: codes) {
|
||||||
|
|
||||||
|
if (i.length() > 1) {
|
||||||
|
int columns = Integer.parseInt(codes[cycleCount * 2]);
|
||||||
|
int rows = codes[cycleCount * 2 + 1].length() / columns;
|
||||||
|
|
||||||
|
char[][] decode = new char[rows][columns];
|
||||||
|
|
||||||
|
char[] chars = i.toCharArray();
|
||||||
|
|
||||||
|
int charCounter = 0;
|
||||||
|
for (int k = 0; k < columns; k++) {
|
||||||
|
|
||||||
|
if (k % 2 != 0) {
|
||||||
|
for (int j = 0; j < rows; j++) {
|
||||||
|
decode[j][k] = chars[charCounter];
|
||||||
|
charCounter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (int j = rows - 1; j > -1; j--) {
|
||||||
|
decode[j][k] = chars[charCounter];
|
||||||
|
charCounter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
charCounter = 0;
|
||||||
|
char[] decodedChar = new char[i.length()];
|
||||||
|
for (int j = 0; j < rows; j++) {
|
||||||
|
|
||||||
|
if (j % 2 == 0) {
|
||||||
|
for (int k = 0; k < columns; k++) {
|
||||||
|
decodedChar[charCounter] = decode[j][k];
|
||||||
|
charCounter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (int k = columns - 1; k > -1; k--) {
|
||||||
|
decodedChar[charCounter] = decode[j][k];
|
||||||
|
charCounter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cycleCount++;
|
||||||
|
String output = String.valueOf(decodedChar);
|
||||||
|
System.out.println(output);
|
||||||
|
}
|
||||||
|
else if (i.equals("0")) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
Source Code/Assignment12Q2/.idea/.gitignore
vendored
Normal file
8
Source Code/Assignment12Q2/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/../../../../../../:\ProgrammingProjects\JavaProjects\JavaYear1\Assignment12Q2\.idea/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
7
Source Code/Assignment12Q2/.idea/codeStyles/Project.xml
Normal file
7
Source Code/Assignment12Q2/.idea/codeStyles/Project.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<ScalaCodeStyleSettings>
|
||||||
|
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
|
||||||
|
</ScalaCodeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||||
|
</state>
|
||||||
|
</component>
|
6
Source Code/Assignment12Q2/.idea/discord.xml
Normal file
6
Source Code/Assignment12Q2/.idea/discord.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DiscordProjectSettings">
|
||||||
|
<option name="show" value="PROJECT" />
|
||||||
|
</component>
|
||||||
|
</project>
|
6
Source Code/Assignment12Q2/.idea/misc.xml
Normal file
6
Source Code/Assignment12Q2/.idea/misc.xml
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/Assignment12Q2/.idea/modules.xml
Normal file
8
Source Code/Assignment12Q2/.idea/modules.xml
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$/Assignment12Q2.iml" filepath="$PROJECT_DIR$/Assignment12Q2.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
11
Source Code/Assignment12Q2/Assignment12Q2.iml
Normal file
11
Source Code/Assignment12Q2/Assignment12Q2.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">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
47
Source Code/Assignment12Q2/src/LendingItem.java
Normal file
47
Source Code/Assignment12Q2/src/LendingItem.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/**
|
||||||
|
* This class holds info for the lent item
|
||||||
|
* @author Isaac Shoebottom (3429069)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class LendingItem {
|
||||||
|
private final String description;
|
||||||
|
private final double price;
|
||||||
|
private final boolean recommended;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for items
|
||||||
|
* @param description Description of item
|
||||||
|
* @param price The price of the item
|
||||||
|
* @param recommended If the item is recommended or not
|
||||||
|
*/
|
||||||
|
public LendingItem(String description, double price, boolean recommended) {
|
||||||
|
this.description = description;
|
||||||
|
this.price = price;
|
||||||
|
this.recommended = recommended;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the description of item
|
||||||
|
* @return The item description
|
||||||
|
*/
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the price of the item
|
||||||
|
* @return The price of the item
|
||||||
|
*/
|
||||||
|
public double getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets if the item is recommended by the book club
|
||||||
|
* @return Boolean of if the item is recommended by the book club
|
||||||
|
*/
|
||||||
|
public boolean isBookClubRecommended() {
|
||||||
|
return recommended;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
278
Source Code/Assignment12Q2/src/LendingLibraryTestDriver.java
Normal file
278
Source Code/Assignment12Q2/src/LendingLibraryTestDriver.java
Normal file
@ -0,0 +1,278 @@
|
|||||||
|
import java.text.NumberFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test driver class to test the ResidentMember, ShortTermResidentMember
|
||||||
|
* and LendingItem classes.
|
||||||
|
*/
|
||||||
|
public class LendingLibraryTestDriver {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
NumberFormat formatter = NumberFormat.getCurrencyInstance();
|
||||||
|
|
||||||
|
//*********************************************************************************
|
||||||
|
|
||||||
|
System.out.println("\n*** Test case #1: Create a Tenant object & test accessors");
|
||||||
|
ResidentMember maria = new ResidentMember("Maria Melani", 152, "555-1234");
|
||||||
|
System.out.println("Name: " + maria.getName()
|
||||||
|
+ "\nAppt #: " + maria.getRoomNumber()
|
||||||
|
+ "\nPhone: " + maria.getPhoneNumber()
|
||||||
|
+ "\nMember #: " + maria.getMembershipNumber());
|
||||||
|
|
||||||
|
LendingItem[] mariasItemList = maria.getSignedOutItems();
|
||||||
|
if (mariasItemList.length == 0) {
|
||||||
|
System.out.println("Correct result: Maria has zero lending items.");
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: Maria has more than zero lending items.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//*********************************************************************************
|
||||||
|
|
||||||
|
System.out.println
|
||||||
|
("\n*** Test case #2: Create a ShortTermResidentMember object & test accessors");
|
||||||
|
ShortTermResidentMember tommy = new ShortTermResidentMember("Tommy Black",
|
||||||
|
302,
|
||||||
|
"555-4321",
|
||||||
|
"Dec. 15, 2020");
|
||||||
|
System.out.println("Name: " + tommy.getName()
|
||||||
|
+ "\nAppt #: " + tommy.getRoomNumber()
|
||||||
|
+ "\nPhone: " + tommy.getPhoneNumber()
|
||||||
|
+ "\nMember #: " + tommy.getMembershipNumber()
|
||||||
|
+ "\nDeparts: " + tommy.getDepartureDate());
|
||||||
|
|
||||||
|
LendingItem[] tommysItemList = tommy.getSignedOutItems();
|
||||||
|
if (tommysItemList.length == 0) {
|
||||||
|
System.out.println("Correct result: Tommy has zero lending items.");
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: Tommy has more than zero lending items.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//*********************************************************************************
|
||||||
|
|
||||||
|
System.out.println("\n*** Test case #3: Automatically generate a member number");
|
||||||
|
ResidentMember testMember = new ResidentMember("Test", 1, "455-1111");
|
||||||
|
if (testMember.getMembershipNumber() == 10002) {
|
||||||
|
System.out.println("Correct result: 10002 is the correct member number.");
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: Invalid member number: " +
|
||||||
|
testMember.getMembershipNumber());
|
||||||
|
}
|
||||||
|
|
||||||
|
//*********************************************************************************
|
||||||
|
|
||||||
|
System.out.println
|
||||||
|
("\n*** Test case #4: Create a LendingItem object & test accessors");
|
||||||
|
|
||||||
|
// Create several LendingItem objects and test the first one
|
||||||
|
final int MAXITEMS = 8;
|
||||||
|
LendingItem[] testItemList = new LendingItem[MAXITEMS + 1];
|
||||||
|
String[] testItemDescription = {"Lean In - Sheryl Sandberg - BOOK",
|
||||||
|
"Maclean's - 23/11/2020 - MAGAZINE",
|
||||||
|
"Headstrong: 52 Women Who Changed Science and the World - Rachel Swaby - BOOK",
|
||||||
|
"The Time Machine - H.G. Wells - BOOK",
|
||||||
|
"The Confidence Code - Katty Kay & Claire Shipman - BOOK",
|
||||||
|
"The Immortal Life of Henrietta Lacks - Rebecca Skloot - BOOK",
|
||||||
|
"Grit - Angela Duckworth - BOOK",
|
||||||
|
"Yoga Journal - October 2020 - MAGAZINE",
|
||||||
|
"Wild - Cheryl Strayed - BOOK"};
|
||||||
|
for (int i = 0; i <= MAXITEMS; i++) {
|
||||||
|
testItemList[i] = new LendingItem(testItemDescription[i],
|
||||||
|
10.00 + (i * 0.25), // Made-up prices
|
||||||
|
(i % 2) == 0); // Every 2nd item is recommended
|
||||||
|
} // end for loop
|
||||||
|
|
||||||
|
System.out.println("Description: " + testItemList[0].getDescription()
|
||||||
|
+ "\nOrig. Price: " + formatter.format(testItemList[0].getPrice())
|
||||||
|
+ "\nBook Club Recommended: " + testItemList[0].isBookClubRecommended());
|
||||||
|
|
||||||
|
//*********************************************************************************
|
||||||
|
|
||||||
|
System.out.println("\n*** Test case #5: Change phone number for both Resident types");
|
||||||
|
String testPhone1 = "555-5566";
|
||||||
|
String testPhone2 = "555-1212";
|
||||||
|
maria.setPhoneNumber(testPhone1);
|
||||||
|
tommy.setPhoneNumber(testPhone2);
|
||||||
|
|
||||||
|
if (maria.getPhoneNumber().equals(testPhone1)) {
|
||||||
|
System.out.println("Correct result: Maria's phone number successfully changed.");
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: Maria's phone number is incorrect: "
|
||||||
|
+ maria.getPhoneNumber());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tommy.getPhoneNumber().equals(testPhone2)) {
|
||||||
|
System.out.println("Correct result: Tommy's phone number successfully changed.");
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: Tommy's phone number is incorrect: "
|
||||||
|
+ tommy.getPhoneNumber());
|
||||||
|
}
|
||||||
|
|
||||||
|
//*********************************************************************************
|
||||||
|
|
||||||
|
System.out.println("\n*** Test case #6: Sign out one LendingItem");
|
||||||
|
|
||||||
|
if (maria.signOut(testItemList[0])) {
|
||||||
|
System.out.println("Correct result: Maria signed out an item successfully.");
|
||||||
|
mariasItemList = maria.getSignedOutItems();
|
||||||
|
if (mariasItemList.length == 1) {
|
||||||
|
System.out.println("Correct result: Maria has one lending item.");
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: Maria has other than one lending item.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: Maria was unable to sign out an item.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//*********************************************************************************
|
||||||
|
|
||||||
|
System.out.println("\n*** Test case #7: Sign out multiple LendingItems");
|
||||||
|
|
||||||
|
boolean successfulSignOut = true;
|
||||||
|
for (int i = 1; i <= 2; i++) {
|
||||||
|
successfulSignOut = successfulSignOut && maria.signOut(testItemList[i]);
|
||||||
|
}
|
||||||
|
if (successfulSignOut) {
|
||||||
|
System.out.println("Correct result: Maria signed out two more items successfully.");
|
||||||
|
mariasItemList = maria.getSignedOutItems();
|
||||||
|
if (mariasItemList.length == 3) {
|
||||||
|
System.out.println("Correct result: Maria has three lending items.");
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: Maria has other than three lending items.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: Maria was unable to sign out two more items.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//*********************************************************************************
|
||||||
|
|
||||||
|
System.out.println("\n*** Test case #8: Intentionally exceed the sign out limit");
|
||||||
|
|
||||||
|
for (int i = 3; i < MAXITEMS; i++) {
|
||||||
|
maria.signOut(testItemList[i]);
|
||||||
|
}
|
||||||
|
if (!maria.signOut(testItemList[MAXITEMS])) {
|
||||||
|
System.out.println("Correct result: Maria was prevented from signing out more than "
|
||||||
|
+ MAXITEMS + " lending items.");
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: Maria was able to sign out more than "
|
||||||
|
+ MAXITEMS + " lending items.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//*********************************************************************************
|
||||||
|
|
||||||
|
System.out.println
|
||||||
|
("\n*** Test case #9: A short-term resident tries to sign out a recommended item");
|
||||||
|
|
||||||
|
LendingItem tommysItem = null;
|
||||||
|
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
if (tommy.signOut(testItemList[i])) {
|
||||||
|
tommysItem = testItemList[i]; // Remember this for Test case #10
|
||||||
|
if (testItemList[i].isBookClubRecommended()) {
|
||||||
|
System.out.println
|
||||||
|
(">> ERROR: Tommy was able to sign out a book club recommended item.");
|
||||||
|
} else {
|
||||||
|
System.out.println
|
||||||
|
("Correct result: Tommy was able to sign out a non recommended item.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (testItemList[i].isBookClubRecommended()) {
|
||||||
|
System.out.println
|
||||||
|
("Correct result: Tommy was prevented from signing out a recommended item.");
|
||||||
|
} else {
|
||||||
|
System.out.println
|
||||||
|
(">> ERROR: Tommy was prevented from signing out a non recommended item.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//end for
|
||||||
|
|
||||||
|
//*********************************************************************************
|
||||||
|
|
||||||
|
System.out.println
|
||||||
|
("\n*** Test case #10: Returning the only item that was signed out");
|
||||||
|
|
||||||
|
int tommyListLength = tommy.getSignedOutItems().length;
|
||||||
|
|
||||||
|
if (tommy.returnItem(tommysItem)) {
|
||||||
|
System.out.println("Correct result: Tommy's item was successfully returned.");
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: Tommy's item was not successfully returned.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tommy.getSignedOutItems().length == tommyListLength - 1) {
|
||||||
|
System.out.println("Correct result: Tommy's list length changed appropriately.");
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: Tommy's list length did not change appropriately.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//*********************************************************************************
|
||||||
|
|
||||||
|
System.out.println("\n*** Test case #11: Returning an item that was not signed out");
|
||||||
|
|
||||||
|
if (tommy.returnItem(testItemList[3])) {
|
||||||
|
System.out.println(">> ERROR: Returned an item that was not signed out.");
|
||||||
|
} else {
|
||||||
|
System.out.println
|
||||||
|
("Correct result: Unsuccessful attempt to return an item that was not signed out.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//*********************************************************************************
|
||||||
|
|
||||||
|
System.out.println
|
||||||
|
("\n*** Test case #12: Returning the first item that was signed out");
|
||||||
|
|
||||||
|
int mariaListLength = maria.getSignedOutItems().length;
|
||||||
|
|
||||||
|
if (maria.returnItem(testItemList[0])) {
|
||||||
|
System.out.println("Correct result: Maria's first item was successfully returned.");
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: Maria's first item was not successfully returned.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maria.getSignedOutItems().length == mariaListLength - 1) {
|
||||||
|
System.out.println("Correct result: Maria's list length changed appropriately.");
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: Maria's list length did not change appropriately.");
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println
|
||||||
|
("\nConfirm return: Lean In should be absent from the following list:");
|
||||||
|
mariasItemList = maria.getSignedOutItems();
|
||||||
|
for (int i = 0; i < mariasItemList.length; i++) {
|
||||||
|
System.out.println(mariasItemList[i].getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//*********************************************************************************
|
||||||
|
|
||||||
|
System.out.println("\n*** Test case #13: Returning a mid-list item");
|
||||||
|
|
||||||
|
mariaListLength = maria.getSignedOutItems().length;
|
||||||
|
|
||||||
|
if (maria.returnItem(testItemList[3])) {
|
||||||
|
System.out.println("Correct result: The Time Machine was successfully returned.");
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: The Time Machine was not successfully returned.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maria.getSignedOutItems().length == mariaListLength - 1) {
|
||||||
|
System.out.println("Correct result: Maria's list length changed appropriately.");
|
||||||
|
} else {
|
||||||
|
System.out.println(">> ERROR: Maria's list length did not change appropriately.");
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println
|
||||||
|
("\nConfirm return: The Time Machine should be absent from the following list:");
|
||||||
|
mariasItemList = maria.getSignedOutItems();
|
||||||
|
for (int i = 0; i < mariasItemList.length; i++) {
|
||||||
|
System.out.println(mariasItemList[i].getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
//*********************************************************************************
|
||||||
|
|
||||||
|
System.out.println("\n************* End of Test Cases ***************\n");
|
||||||
|
|
||||||
|
} // end main method
|
||||||
|
|
||||||
|
|
||||||
|
} // end LendingTestDriver class
|
113
Source Code/Assignment12Q2/src/ResidentMember.java
Normal file
113
Source Code/Assignment12Q2/src/ResidentMember.java
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
/**
|
||||||
|
* This class holds info for members
|
||||||
|
* @author Isaac Shoebottom (3429069)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public class ResidentMember {
|
||||||
|
private static int membership = 9999;
|
||||||
|
private final String name;
|
||||||
|
private final int room;
|
||||||
|
private final LendingItem[] list;
|
||||||
|
private String phone;
|
||||||
|
private int bookCounter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for members
|
||||||
|
* @param name Name of member
|
||||||
|
* @param room Room of member
|
||||||
|
* @param phone Phone of member
|
||||||
|
*/
|
||||||
|
public ResidentMember(String name, int room, String phone) {
|
||||||
|
this.name = name;
|
||||||
|
this.room = room;
|
||||||
|
this.phone = phone;
|
||||||
|
list = new LendingItem[8];
|
||||||
|
bookCounter = 0;
|
||||||
|
membership++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the signed out items of a member
|
||||||
|
* @return The updated list item list
|
||||||
|
*/
|
||||||
|
public LendingItem[] getSignedOutItems() {
|
||||||
|
LendingItem[] updatedItemList = new LendingItem[bookCounter];
|
||||||
|
for (int i = 0; i < bookCounter; i++) {
|
||||||
|
updatedItemList[i] = list[i];
|
||||||
|
}
|
||||||
|
return updatedItemList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to sign out items for members
|
||||||
|
* @param input The item to be lent
|
||||||
|
* @return Boolean for if the item was signed out or not
|
||||||
|
*/
|
||||||
|
public boolean signOut(LendingItem input) {
|
||||||
|
if (bookCounter < 8) {
|
||||||
|
list[bookCounter] = input;
|
||||||
|
bookCounter++;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns and item for members
|
||||||
|
* @param input The item to be returned
|
||||||
|
* @return Boolean if the item was returned
|
||||||
|
*/
|
||||||
|
public boolean returnItem(LendingItem input) {
|
||||||
|
boolean success = false;
|
||||||
|
for (int i = 0; i < bookCounter; i++) {
|
||||||
|
if (list[i] == input) {
|
||||||
|
list[i] = list[bookCounter - 1];
|
||||||
|
bookCounter--;
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the name of member
|
||||||
|
* @return The name of member
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the room of member
|
||||||
|
* @return The room of member
|
||||||
|
*/
|
||||||
|
public int getRoomNumber() {
|
||||||
|
return room;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the phone number of member
|
||||||
|
* @return The phone number of member
|
||||||
|
*/
|
||||||
|
public String getPhoneNumber() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the phone of member
|
||||||
|
* @param phone
|
||||||
|
*/
|
||||||
|
public void setPhoneNumber(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the membership number of member
|
||||||
|
* @return The membership number of member
|
||||||
|
*/
|
||||||
|
public int getMembershipNumber() {
|
||||||
|
return membership;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
43
Source Code/Assignment12Q2/src/ShortTermResidentMember.java
Normal file
43
Source Code/Assignment12Q2/src/ShortTermResidentMember.java
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/**
|
||||||
|
* This class holds info for short term members
|
||||||
|
* @author Isaac Shoebottom (3429069)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public class ShortTermResidentMember extends ResidentMember {
|
||||||
|
private final String departureDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for short term members
|
||||||
|
* @param name Name of short term member
|
||||||
|
* @param room Room of short term member
|
||||||
|
* @param phone Phone of short term member
|
||||||
|
* @param departureDate The departure date of short term members
|
||||||
|
*/
|
||||||
|
public ShortTermResidentMember(String name, int room, String phone, String departureDate) {
|
||||||
|
super(name, room, phone);
|
||||||
|
this.departureDate = departureDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to sign out items for short term members
|
||||||
|
* @param input The item to be signed out
|
||||||
|
* @return Boolean for if the item was signed out or not
|
||||||
|
*/
|
||||||
|
public boolean signOut(LendingItem input) {
|
||||||
|
if (input.isBookClubRecommended()) {
|
||||||
|
super.signOut(input);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the departure date for short term members
|
||||||
|
* @return The departure date
|
||||||
|
*/
|
||||||
|
public String getDepartureDate() {
|
||||||
|
return departureDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
8
Source Code/Assignment2/.idea/.gitignore
vendored
Normal file
8
Source Code/Assignment2/.idea/.gitignore
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
Normal file
25
Source Code/Assignment2/.idea/codeStyles/Project.xml
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>
|
@ -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
Normal file
6
Source Code/Assignment2/.idea/misc.xml
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
Normal file
8
Source Code/Assignment2/.idea/modules.xml
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.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user