diff --git a/Circles/build.xml b/Circles/build.xml new file mode 100644 index 00000000..e69de29b diff --git a/Coverage/.gitignore b/Coverage/.gitignore index ae3c1726..92145bce 100644 --- a/Coverage/.gitignore +++ b/Coverage/.gitignore @@ -1 +1,2 @@ /bin/ +/target/ \ No newline at end of file diff --git a/Coverage/build.xml b/Coverage/build.xml index ed99bbd8..55110317 100644 --- a/Coverage/build.xml +++ b/Coverage/build.xml @@ -1,77 +1,355 @@ - + - - + + + + + + + - - - + + + - - - - + + + + + - - - - - - + + + + + - - - - - - - - - - - - - - - - - + + + run needed... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + report needed... + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + - - - - - - - + + + + + + + diff --git a/Coverage/src/edu/nmsu/cs/scoring/RacingScore1.java b/Coverage/src/edu/nmsu/cs/scoring/RacingScore1.java index f0b63476..7d832f16 100644 --- a/Coverage/src/edu/nmsu/cs/scoring/RacingScore1.java +++ b/Coverage/src/edu/nmsu/cs/scoring/RacingScore1.java @@ -10,6 +10,14 @@ * ***/ + /*** + Issue found: Higher score was stored after comparing score1 and score2 + + Issue found: Values over 50 and negative values are not handled + + + + ***/ public class RacingScore1 { @@ -35,13 +43,16 @@ public void recordScores(int s1, int s2, int s3) public int overallScore() { - int s; - if (score1 < score2) - s = score2; + int s; // variable to store lowest score + + if (score1 < score2) + s = score1; // changed s to store lower value else - s = score1; - if (s > score3) + s = score2; + + if(s > score3) s = score3; + s = (score1 + score2 + score3) - s; return s; } diff --git a/Coverage/src/edu/nmsu/cs/scoring/RacingScore2.java b/Coverage/src/edu/nmsu/cs/scoring/RacingScore2.java index 416ebe6b..1af5b61b 100644 --- a/Coverage/src/edu/nmsu/cs/scoring/RacingScore2.java +++ b/Coverage/src/edu/nmsu/cs/scoring/RacingScore2.java @@ -10,6 +10,13 @@ * ***/ +/*** + Issue found: score2 and score3 being the same would default to s2 and s3 = 99, fixed by adding = to comparisons + changed else statement to default to s1 and s2 + + Issue found: Removed args = NULL condition to avoid redundancy + ***/ + public class RacingScore2 { @@ -36,26 +43,21 @@ public void recordScores(int s1, int s2, int s3) public int overallScore() { int s, s1, s2; - if (score1 < score2 && score1 < score3) + if (score1 <= score2 && score1 <= score3) { s1 = score2; s2 = score3; } - else if (score2 < score1 && score2 < score3) + else if (score2 <= score1 && score2 <= score3) { s1 = score1; s2 = score2; } - else if (score3 < score1 && score3 < score2) + else { s1 = score1; s2 = score2; } - else - { - s1 = 99; - s2 = 99; - } s = s1 + s2; return s; } @@ -63,7 +65,7 @@ else if (score3 < score1 && score3 < score2) public static void main(String args[]) { int s1, s2, s3; - if (args == null || args.length != 3) + if (args.length != 3) { System.err.println("Error: must supply three arguments!"); return; diff --git a/HelloWorld/src/edu/nmsu/cs/helloworld/HelloWorld.java b/HelloWorld/src/edu/nmsu/cs/helloworld/HelloWorld.java new file mode 100644 index 00000000..6a2da58a --- /dev/null +++ b/HelloWorld/src/edu/nmsu/cs/helloworld/HelloWorld.java @@ -0,0 +1,7 @@ +package edu.nmsu.cs.helloworld; + +public class HelloWorld { + public static void main(String[] args) { + System.out.println("Hello world"); + } +} \ No newline at end of file diff --git a/README.md b/README.md index 685238c5..dd9989de 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Programs +# Programs from Jweston1080 Base code for program assignments in Software Development (C S 371). ## Program 1 and Program 2 @@ -9,3 +9,5 @@ This assignment relies on the Coverage programs. ## Program 4 This assignment relies on the Circles programs. + +## Contains the question files for assignment 1 and 2 \ No newline at end of file diff --git a/SimpleWebServer/.metadata/.lock b/SimpleWebServer/.metadata/.lock new file mode 100644 index 00000000..e69de29b diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.location b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.location new file mode 100644 index 00000000..9bc7cae6 Binary files /dev/null and b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.location differ diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version new file mode 100644 index 00000000..25cb955b --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index new file mode 100644 index 00000000..d2372511 Binary files /dev/null and b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index differ diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version new file mode 100644 index 00000000..6b2aaa76 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.root/3.tree b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.root/3.tree new file mode 100644 index 00000000..dd0d11f9 Binary files /dev/null and b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.root/3.tree differ diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources new file mode 100644 index 00000000..f1bb0600 Binary files /dev/null and b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources differ diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..30841ebf --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +encoding=UTF-8 +version=1 diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.e4.ui.css.swt.theme.prefs b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.e4.ui.css.swt.theme.prefs new file mode 100644 index 00000000..77840f22 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.e4.ui.css.swt.theme.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +themeid=org.eclipse.e4.ui.css.theme.e4_dark diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.e4.ui.workbench.renderers.swt.prefs b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.e4.ui.workbench.renderers.swt.prefs new file mode 100644 index 00000000..95926f8d --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.e4.ui.workbench.renderers.swt.prefs @@ -0,0 +1,4 @@ +USE_ROUND_TABS=false +eclipse.preferences.version=1 +enableMRU=true +themeEnabled=true diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000..7117ec32 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.ui.formatterprofiles.version=22 +spelling_locale_initialized=true +typefilter_migrated_2=true +useAnnotationsPrefPage=true +useQuickDiffPrefPage=true diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jsch.core.prefs b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jsch.core.prefs new file mode 100644 index 00000000..d56c53f1 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jsch.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jsch.core.hasChangedDefaultWin32SshHome=true diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.discovery.prefs b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.discovery.prefs new file mode 100644 index 00000000..67b1d96c --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.discovery.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.m2e.discovery.pref.projects= diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs new file mode 100644 index 00000000..e37f58cd --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +platformState=1676321461019 +quickStart=false +tipsAndTricks=true diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs new file mode 100644 index 00000000..08076f23 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +showIntro=false diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs new file mode 100644 index 00000000..7e380fb0 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs @@ -0,0 +1,12 @@ +//org.eclipse.ui.commands/state/org.eclipse.ui.navigator.resources.nested.changeProjectPresentation/org.eclipse.ui.commands.radioState=false +PLUGINS_NOT_ACTIVATED_ON_STARTUP=;org.eclipse.m2e.discovery; +eclipse.preferences.version=1 +org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_END=41,41,41 +org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_START=43,44,45 +org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_TEXT_COLOR=204,204,204 +org.eclipse.ui.workbench.ACTIVE_TAB_BG_END=41,41,41 +org.eclipse.ui.workbench.ACTIVE_TAB_BG_START=43,44,45 +org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR=221,221,221 +org.eclipse.ui.workbench.INACTIVE_TAB_BG_END=49,53,56 +org.eclipse.ui.workbench.INACTIVE_TAB_BG_START=59,64,66 +org.eclipse.ui.workbench.INACTIVE_TAB_TEXT_COLOR=187,187,187 diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi b/SimpleWebServer/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi new file mode 100644 index 00000000..07864a96 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi @@ -0,0 +1,2153 @@ + + + + activeSchemeId:org.eclipse.ui.defaultAcceleratorConfiguration + + + + + + + + topLevel + + + + + persp.actionSet:org.eclipse.ui.cheatsheets.actionSet + persp.actionSet:org.eclipse.search.searchActionSet + persp.actionSet:org.eclipse.text.quicksearch.actionSet + persp.actionSet:org.eclipse.ui.edit.text.actionSet.annotationNavigation + persp.actionSet:org.eclipse.ui.edit.text.actionSet.navigation + persp.actionSet:org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo + persp.actionSet:org.eclipse.ui.externaltools.ExternalToolsSet + persp.actionSet:org.eclipse.ui.actionSet.keyBindings + persp.actionSet:org.eclipse.ui.actionSet.openFiles + persp.actionSet:org.eclipse.debug.ui.launchActionSet + persp.actionSet:org.eclipse.jdt.ui.JavaActionSet + persp.actionSet:org.eclipse.jdt.ui.JavaElementCreationActionSet + persp.actionSet:org.eclipse.ui.NavigateActionSet + persp.viewSC:org.eclipse.jdt.ui.PackageExplorer + persp.viewSC:org.eclipse.jdt.ui.TypeHierarchy + persp.viewSC:org.eclipse.jdt.ui.SourceView + persp.viewSC:org.eclipse.jdt.ui.JavadocView + persp.viewSC:org.eclipse.search.ui.views.SearchView + persp.viewSC:org.eclipse.ui.console.ConsoleView + persp.viewSC:org.eclipse.ui.views.ContentOutline + persp.viewSC:org.eclipse.ui.views.ProblemView + persp.viewSC:org.eclipse.ui.views.ResourceNavigator + persp.viewSC:org.eclipse.ui.views.TaskList + persp.viewSC:org.eclipse.ui.views.ProgressView + persp.viewSC:org.eclipse.ui.navigator.ProjectExplorer + persp.viewSC:org.eclipse.ui.texteditor.TemplatesView + persp.viewSC:org.eclipse.pde.runtime.LogView + persp.newWizSC:org.eclipse.jdt.ui.wizards.JavaProjectWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewPackageCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewClassCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewEnumCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewRecordCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewJavaWorkingSetWizard + persp.newWizSC:org.eclipse.ui.wizards.new.folder + persp.newWizSC:org.eclipse.ui.wizards.new.file + persp.newWizSC:org.eclipse.ui.editors.wizards.UntitledTextFileWizard + persp.perspSC:org.eclipse.jdt.ui.JavaBrowsingPerspective + persp.perspSC:org.eclipse.debug.ui.DebugPerspective + persp.showIn:org.eclipse.jdt.ui.PackageExplorer + persp.showIn:org.eclipse.team.ui.GenericHistoryView + persp.showIn:org.eclipse.ui.navigator.ProjectExplorer + persp.actionSet:org.eclipse.debug.ui.breakpointActionSet + persp.actionSet:org.eclipse.jdt.debug.ui.JDTDebugActionSet + persp.showIn:org.eclipse.egit.ui.RepositoriesView + persp.actionSet:org.eclipse.eclemma.ui.CoverageActionSet + persp.showIn:org.eclipse.eclemma.ui.CoverageView + persp.viewSC:org.eclipse.tm.terminal.view.ui.TerminalsView + persp.showIn:org.eclipse.tm.terminal.view.ui.TerminalsView + persp.newWizSC:org.eclipse.jdt.junit.wizards.NewTestCaseCreationWizard + persp.actionSet:org.eclipse.jdt.junit.JUnitActionSet + persp.viewSC:org.eclipse.ant.ui.views.AntView + + + + org.eclipse.e4.primaryNavigationStack + active + + View + categoryTag:Java + + + View + categoryTag:Java + + + View + categoryTag:General + + + View + categoryTag:Java + + + + + View + categoryTag:Git + + + + + + + + org.eclipse.e4.secondaryNavigationStack + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:Ant + + + + + org.eclipse.e4.secondaryDataStack + + View + categoryTag:General + + + View + categoryTag:Java + + + View + categoryTag:Java + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:Terminal + + + + + + + + + View + categoryTag:Help + + + View + categoryTag:General + + + View + categoryTag:Help + + + + + + + View + categoryTag:Help + + + + + + View + categoryTag:General + + ViewMenu + menuContribution:menu + + + + + + + View + categoryTag:Help + + + + org.eclipse.e4.primaryDataStack + EditorStack + + + + + + + View + categoryTag:Java + active + activeOnClose + + ViewMenu + menuContribution:menu + + + + + + + View + categoryTag:Java + + + + + View + categoryTag:General + + + + + + View + categoryTag:General + + ViewMenu + menuContribution:menu + + + + + + + View + categoryTag:Java + + + + + View + categoryTag:Java + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + + View + categoryTag:General + + ViewMenu + menuContribution:menu + + + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:Git + + + + + View + categoryTag:Terminal + + + + + View + categoryTag:Java + + + + + View + categoryTag:Ant + + + + toolbarSeparator + + + + Draggable + + + + toolbarSeparator + + + + Draggable + + + toolbarSeparator + + + + Draggable + + + Draggable + + + Draggable + + + toolbarSeparator + + + + Draggable + + + + toolbarSeparator + + + + toolbarSeparator + + + + Draggable + + + stretch + SHOW_RESTORE_MENU + + + Draggable + HIDEABLE + SHOW_RESTORE_MENU + + + + + stretch + + + Draggable + + + Draggable + + + + + TrimStack + Draggable + + + + + + + + + + + + + + + + + + + + + + platform:win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + platform:win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Editor + removeOnHide + + + + + View + categoryTag:Ant + + + + + View + categoryTag:Gradle + + + + + View + categoryTag:Gradle + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + View + categoryTag:Debug + + + + + View + categoryTag:Java + + + + + View + categoryTag:Git + + + + + View + categoryTag:Git + + + + + View + categoryTag:Git + + + + + View + categoryTag:Git + NoRestore + + + + + View + categoryTag:Git + + + + + View + categoryTag:Help + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Java + + + + + View + categoryTag:Java + + + + + View + categoryTag:Java + + + + + View + categoryTag:Java Browsing + + + + + View + categoryTag:Java Browsing + + + + + View + categoryTag:Java Browsing + + + + + View + categoryTag:Java Browsing + + + + + View + categoryTag:Java + + + + + View + categoryTag:General + + + + + View + categoryTag:Java + + + + + View + categoryTag:Java + + + + + View + categoryTag:Maven + + + + + View + categoryTag:Maven + + + + + View + categoryTag:Maven + + + + + View + categoryTag:Oomph + + + + + View + categoryTag:General + + + + + View + categoryTag:Version Control (Team) + + + + + View + categoryTag:Version Control (Team) + + + View + categoryTag:Help + + + + + View + categoryTag:Terminal + + + + + View + categoryTag:Other + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:Help + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + glue + move_after:PerspectiveSpacer + SHOW_RESTORE_MENU + + + move_after:Spacer Glue + HIDEABLE + SHOW_RESTORE_MENU + + + glue + move_after:SearchField + SHOW_RESTORE_MENU + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.egit.core/.org.eclipse.egit.core.cmp/.settings/org.eclipse.core.resources.prefs b/SimpleWebServer/.metadata/.plugins/org.eclipse.egit.core/.org.eclipse.egit.core.cmp/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..99f26c02 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.egit.core/.org.eclipse.egit.core.cmp/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache new file mode 100644 index 00000000..593f4708 Binary files /dev/null and b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache differ diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache new file mode 100644 index 00000000..593f4708 Binary files /dev/null and b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache differ diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.core/javaLikeNames.txt b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.core/javaLikeNames.txt new file mode 100644 index 00000000..85863977 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.core/javaLikeNames.txt @@ -0,0 +1 @@ +java \ No newline at end of file diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache new file mode 100644 index 00000000..593f4708 Binary files /dev/null and b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache differ diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat new file mode 100644 index 00000000..0edae4b2 Binary files /dev/null and b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat differ diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml new file mode 100644 index 00000000..a4ee3cbc --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml @@ -0,0 +1,2 @@ + + diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml new file mode 100644 index 00000000..9e390f50 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml @@ -0,0 +1,2 @@ + + diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml new file mode 100644 index 00000000..0c20a0f9 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml @@ -0,0 +1,10 @@ + +
+
+ + + + + +
+
diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.m2e.core/workspaceState.ser b/SimpleWebServer/.metadata/.plugins/org.eclipse.m2e.core/workspaceState.ser new file mode 100644 index 00000000..abbf8e52 Binary files /dev/null and b/SimpleWebServer/.metadata/.plugins/org.eclipse.m2e.core/workspaceState.ser differ diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.1.0.20221015-0744.xml b/SimpleWebServer/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.1.0.20221015-0744.xml new file mode 100644 index 00000000..abdf1c73 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.1.0.20221015-0744.xml @@ -0,0 +1,41 @@ + + + + %date [%thread] %-5level %logger{35} - %msg%n + + + OFF + + + + + ${org.eclipse.m2e.log.dir}/0.log + + ${org.eclipse.m2e.log.dir}/%i.log + 1 + 10 + + + 10MB + + + %date [%thread] %-5level %logger{35} - %msg%n + + + + + + WARN + + + + + + + + + + + + + diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.oomph.setup/workspace.setup b/SimpleWebServer/.metadata/.plugins/org.eclipse.oomph.setup/workspace.setup new file mode 100644 index 00000000..1f73e14c --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.oomph.setup/workspace.setup @@ -0,0 +1,6 @@ + + diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.tips.ide/dialog_settings.xml b/SimpleWebServer/.metadata/.plugins/org.eclipse.tips.ide/dialog_settings.xml new file mode 100644 index 00000000..5ca0b776 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.tips.ide/dialog_settings.xml @@ -0,0 +1,3 @@ + +
+
diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml b/SimpleWebServer/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml new file mode 100644 index 00000000..45c1c7c1 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml @@ -0,0 +1,17 @@ + +
+
+ + + + +
+
+ + +
+
+ + +
+
diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.ui.intro/introstate b/SimpleWebServer/.metadata/.plugins/org.eclipse.ui.intro/introstate new file mode 100644 index 00000000..02f134f0 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.ui.intro/introstate @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml b/SimpleWebServer/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml new file mode 100644 index 00000000..5ca0b776 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml @@ -0,0 +1,3 @@ + +
+
diff --git a/SimpleWebServer/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml b/SimpleWebServer/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml new file mode 100644 index 00000000..520afd01 --- /dev/null +++ b/SimpleWebServer/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SimpleWebServer/.metadata/version.ini b/SimpleWebServer/.metadata/version.ini new file mode 100644 index 00000000..1c854a42 --- /dev/null +++ b/SimpleWebServer/.metadata/version.ini @@ -0,0 +1,3 @@ +#Mon Feb 13 15:17:54 MST 2023 +org.eclipse.core.runtime=2 +org.eclipse.platform=4.26.0.v20221123-1800 diff --git a/SimpleWebServer/.settings/org.eclipse.jdt.core.prefs b/SimpleWebServer/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..59fe89dc --- /dev/null +++ b/SimpleWebServer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,15 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/SimpleWebServer/build.xml b/SimpleWebServer/build.xml new file mode 100644 index 00000000..a739cab2 --- /dev/null +++ b/SimpleWebServer/build.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SimpleWebServer/res/acc/cat.png b/SimpleWebServer/res/acc/cat.png new file mode 100644 index 00000000..08db4b4d Binary files /dev/null and b/SimpleWebServer/res/acc/cat.png differ diff --git a/SimpleWebServer/res/acc/hello.html b/SimpleWebServer/res/acc/hello.html new file mode 100644 index 00000000..3bc5cf19 --- /dev/null +++ b/SimpleWebServer/res/acc/hello.html @@ -0,0 +1,7 @@ + + + + +

Hello world, the current date is: . The server is: .

+ + \ No newline at end of file diff --git a/SimpleWebServer/src/edu/nmsu/cs/webserver/WebWorker.java b/SimpleWebServer/src/edu/nmsu/cs/webserver/WebWorker.java index 78bba687..7d67003d 100644 --- a/SimpleWebServer/src/edu/nmsu/cs/webserver/WebWorker.java +++ b/SimpleWebServer/src/edu/nmsu/cs/webserver/WebWorker.java @@ -19,6 +19,9 @@ * **/ + import java.io.FileInputStream; +import java.io.FileReader; +import java.io.File; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; @@ -32,7 +35,7 @@ public class WebWorker implements Runnable { private Socket socket; - + /** * Constructor: must have a valid open socket **/ @@ -40,7 +43,7 @@ public WebWorker(Socket s) { socket = s; } - + /** * Worker thread starting point. Each worker handles just one HTTP request and then returns, which * destroys the thread. This method assumes that whoever created the worker created it with a @@ -53,9 +56,31 @@ public void run() { InputStream is = socket.getInputStream(); OutputStream os = socket.getOutputStream(); - readHTTPRequest(is); - writeHTTPHeader(os, "text/html"); - writeContent(os); + File in_file = readHTTPRequest(is); + + String cType = ""; + String path = in_file.getPath(); + + if(path.contains(".jpeg")) { + cType = "image/jpeg"; + } + else if(path.contains(".png")) { + cType = "image/png"; + } + else if(path.contains(".gif")) { + cType = "image/gif"; + } + else if(path.contains(".html")) { + cType = "image/png"; + } + else if(path.contains("favicon.ico")) { + cType = "image/x-icon"; + } + else { + System.err.println("Failed to get input file type. Input file type may not be supported.\n"); + } + writeHTTPHeader(os, in_file, cType); + writeContent(os, in_file, cType); os.flush(); socket.close(); } @@ -70,9 +95,11 @@ public void run() /** * Read the HTTP request header. **/ - private void readHTTPRequest(InputStream is) + private File readHTTPRequest(InputStream is) { + String line; + File f = null; BufferedReader r = new BufferedReader(new InputStreamReader(is)); while (true) { @@ -81,19 +108,35 @@ private void readHTTPRequest(InputStream is) while (!r.ready()) Thread.sleep(1); line = r.readLine(); - System.err.println("Request line: (" + line + ")"); if (line.length() == 0) break; + + if(line.startsWith("GET")) { + String pFile = line.substring(4, line.lastIndexOf(" ")); + String currentWorkingDir = System.getProperty("user.dir"); + String final_path = pFile + currentWorkingDir; + try { + + f = new File(final_path); + } + catch(Exception e) { + e.printStackTrace(); + } + } + System.err.println("Request line: (" + line + ")"); } + + catch (Exception e) { System.err.println("Request error: " + e); break; } } - return; + return f; } + /** * Write the HTTP header lines to the client network connection. * @@ -102,22 +145,27 @@ private void readHTTPRequest(InputStream is) * @param contentType * is the string MIME content type (e.g. "text/html") **/ - private void writeHTTPHeader(OutputStream os, String contentType) throws Exception + private void writeHTTPHeader(OutputStream os, File file, String contentType) throws Exception { Date d = new Date(); DateFormat df = DateFormat.getDateTimeInstance(); df.setTimeZone(TimeZone.getTimeZone("GMT")); - os.write("HTTP/1.1 200 OK\n".getBytes()); + + if(file.exists()) { + os.write("HTTP/1.1 200 OK\n".getBytes()); + } + else { + os.write("HTTP/1.1 404 NOT FOUND".getBytes()); + } os.write("Date: ".getBytes()); os.write((df.format(d)).getBytes()); os.write("\n".getBytes()); - os.write("Server: Jon's very own server\n".getBytes()); - // os.write("Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT\n".getBytes()); - // os.write("Content-Length: 438\n".getBytes()); + os.write("Jason's server\n".getBytes()); os.write("Connection: close\n".getBytes()); os.write("Content-Type: ".getBytes()); os.write(contentType.getBytes()); os.write("\n\n".getBytes()); // HTTP header ends with 2 newlines + // end else return; } @@ -128,11 +176,45 @@ private void writeHTTPHeader(OutputStream os, String contentType) throws Excepti * @param os * is the OutputStream object to write to **/ - private void writeContent(OutputStream os) throws Exception + private void writeContent(OutputStream os, File f, String type) throws Exception { - os.write("\n".getBytes()); - os.write("

My web server works!

\n".getBytes()); - os.write("\n".getBytes()); + if (!f.exists()){ + os.write("\n".getBytes()); + os.write("

My web server works!

\n".getBytes()); + os.write("\n".getBytes()); + + } + else if (type.equals("text/html")){ + FileReader fr = new FileReader(f); + BufferedReader br = new BufferedReader(fr); + String line; + + while((line=br.readLine()) != null) { + + if(line.contains("")) { + Date d = new Date(); + DateFormat df = DateFormat.getDateTimeInstance(); + df.setTimeZone(TimeZone.getTimeZone("GMT")); + line = line.replaceAll("", df.format(d)); + } + + if (line.contains("")){ + line = line.replaceAll("", "Jason's Web Server"); + } + + os.write(line.getBytes()); + } + br.close(); + } + else { + FileInputStream fip = new FileInputStream(f); + + int bytesRead; + while ((bytesRead=fip.read())!=-1) { + os.write(bytesRead); + } + fip.close(); + } } -} // end class +} // end class \ No newline at end of file diff --git a/SimpleWebServer/src/module-info.java b/SimpleWebServer/src/module-info.java new file mode 100644 index 00000000..0aecc02e --- /dev/null +++ b/SimpleWebServer/src/module-info.java @@ -0,0 +1,9 @@ +/** + * + */ +/** + * @author Jason + * + */ +module SimpleWebServer { +} \ No newline at end of file diff --git a/SimpleWebServer/www/cat.gif b/SimpleWebServer/www/cat.gif new file mode 100644 index 00000000..98fa1191 Binary files /dev/null and b/SimpleWebServer/www/cat.gif differ diff --git a/SimpleWebServer/www/cat.jpeg b/SimpleWebServer/www/cat.jpeg new file mode 100644 index 00000000..47a390ec Binary files /dev/null and b/SimpleWebServer/www/cat.jpeg differ diff --git a/SimpleWebServer/www/cat.png b/SimpleWebServer/www/cat.png new file mode 100644 index 00000000..08db4b4d Binary files /dev/null and b/SimpleWebServer/www/cat.png differ diff --git a/SimpleWebServer/www/hello.html b/SimpleWebServer/www/hello.html new file mode 100644 index 00000000..3bc5cf19 --- /dev/null +++ b/SimpleWebServer/www/hello.html @@ -0,0 +1,7 @@ + + + + +

Hello world, the current date is: . The server is: .

+ + \ No newline at end of file diff --git a/SimpleWebServer/www/icon.png b/SimpleWebServer/www/icon.png new file mode 100644 index 00000000..462edb71 Binary files /dev/null and b/SimpleWebServer/www/icon.png differ diff --git a/SimpleWebServer/www/test.html b/SimpleWebServer/www/test.html new file mode 100644 index 00000000..f69158ac --- /dev/null +++ b/SimpleWebServer/www/test.html @@ -0,0 +1,12 @@ + + + + Jason's Web Server +

Cute cats

+ + + + + + + \ No newline at end of file diff --git a/p1Questions.txt b/p1Questions.txt new file mode 100644 index 00000000..3e23b8b1 --- /dev/null +++ b/p1Questions.txt @@ -0,0 +1,12 @@ +1. Estimate the time it will take you to do the assignment, to within a quarter-hour: + I believe this assignment will take me roughly 2 hours of work. + +2. Estimate the time it took you to complete the assignment, broken down as: + +Thought/Design: 1 hour +Programming: 5 hours +Debugging: 2 hours +TOTAL: 8 hours + +3. To within what percent accuracy was your original estimate: + I was 25% accurate, this assignment was much harder than expected. \ No newline at end of file diff --git a/p2Questions.txt b/p2Questions.txt new file mode 100644 index 00000000..b7bd4113 --- /dev/null +++ b/p2Questions.txt @@ -0,0 +1,12 @@ +1. Estimate the time it will take you to do the assignment, to within a quarter-hour: + I believe this assignment will take me roughly 5 hours of work. + +2. Estimate the time it took you to complete the assignment, broken down as: + +Thought/Design: 3 hours +Programming: 6 hours +Debugging: 4 hours +TOTAL: 13 hours + +3. To within what percent accuracy was your original estimate: + I was 37% accurate, this assignment was much harder than expected. \ No newline at end of file