This commit is contained in:
ldy
2026-03-01 23:18:55 -05:00
commit 67f753a5d1
3087 changed files with 218259 additions and 0 deletions

View File

@@ -0,0 +1,177 @@
!SESSION 2023-03-28 16:09:49.099 -----------------------------------------------
eclipse.buildId=4.26.0.20221201-1200
java.version=17.0.6
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product -data E:\JAVA 2023\Assignment2_2230026071 -product org.eclipse.epp.package.jee.product
!ENTRY ch.qos.logback.classic 1 0 2023-03-28 16:09:50.000
!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized.
!ENTRY ch.qos.logback.classic 1 0 2023-03-28 16:09:50.709
!MESSAGE Logback config file: E:\JAVA 2023\Assignment2_2230026071\.metadata\.plugins\org.eclipse.m2e.logback\logback.2.1.0.20221015-0744.xml
!ENTRY org.eclipse.jface 2 0 2023-03-28 16:09:52.447
!MESSAGE Keybinding conflicts occurred. They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2023-03-28 16:09:52.447
!MESSAGE A conflict occurred for CTRL+SHIFT+T:
Binding(CTRL+SHIFT+T,
ParameterizedCommand(Command(org.eclipse.jdt.ui.navigate.open.type,Open Type,
Open a type in a Java editor,
Category(org.eclipse.ui.category.navigate,Navigate,null,true),
WorkbenchHandlerServiceHandler("org.eclipse.jdt.ui.navigate.open.type"),
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(CTRL+SHIFT+T,
ParameterizedCommand(Command(org.eclipse.lsp4e.symbolinworkspace,Go to Symbol in Workspace,
,
Category(org.eclipse.lsp4e.category,Language Servers,null,true),
WorkbenchHandlerServiceHandler("org.eclipse.lsp4e.symbolinworkspace"),
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
!SUBENTRY 1 org.eclipse.jface 2 0 2023-03-28 16:09:52.447
!MESSAGE A conflict occurred for ALT+SHIFT+R:
Binding(ALT+SHIFT+R,
ParameterizedCommand(Command(org.eclipse.jdt.ui.edit.text.java.rename.element,Rename - Refactoring ,
Rename the selected element,
Category(org.eclipse.jdt.ui.category.refactoring,Refactor - Java,Java Refactoring Actions,true),
WorkbenchHandlerServiceHandler("org.eclipse.jdt.ui.edit.text.java.rename.element"),
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(ALT+SHIFT+R,
ParameterizedCommand(Command(org.eclipse.ui.edit.rename,Rename,
Rename the selected item,
Category(org.eclipse.ui.category.file,File,null,true),
WorkbenchHandlerServiceHandler("org.eclipse.ui.edit.rename"),
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
!ENTRY org.eclipse.egit.ui 2 0 2023-03-28 16:09:55.396
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\Danie'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
!SESSION 2023-03-28 17:13:34.646 -----------------------------------------------
eclipse.buildId=4.26.0.20221201-1200
java.version=17.0.6
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product
!ENTRY ch.qos.logback.classic 1 0 2023-03-28 17:13:35.540
!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized.
!ENTRY ch.qos.logback.classic 1 0 2023-03-28 17:13:36.342
!MESSAGE Logback config file: E:\JAVA 2023\Assignment2_2230026071\.metadata\.plugins\org.eclipse.m2e.logback\logback.2.1.0.20221015-0744.xml
!ENTRY org.eclipse.jface 2 0 2023-03-28 17:13:38.221
!MESSAGE Keybinding conflicts occurred. They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2023-03-28 17:13:38.221
!MESSAGE A conflict occurred for CTRL+SHIFT+T:
Binding(CTRL+SHIFT+T,
ParameterizedCommand(Command(org.eclipse.jdt.ui.navigate.open.type,Open Type,
Open a type in a Java editor,
Category(org.eclipse.ui.category.navigate,Navigate,null,true),
WorkbenchHandlerServiceHandler("org.eclipse.jdt.ui.navigate.open.type"),
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(CTRL+SHIFT+T,
ParameterizedCommand(Command(org.eclipse.lsp4e.symbolinworkspace,Go to Symbol in Workspace,
,
Category(org.eclipse.lsp4e.category,Language Servers,null,true),
WorkbenchHandlerServiceHandler("org.eclipse.lsp4e.symbolinworkspace"),
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
!SUBENTRY 1 org.eclipse.jface 2 0 2023-03-28 17:13:38.221
!MESSAGE A conflict occurred for ALT+SHIFT+R:
Binding(ALT+SHIFT+R,
ParameterizedCommand(Command(org.eclipse.jdt.ui.edit.text.java.rename.element,Rename - Refactoring ,
Rename the selected element,
Category(org.eclipse.jdt.ui.category.refactoring,Refactor - Java,Java Refactoring Actions,true),
WorkbenchHandlerServiceHandler("org.eclipse.jdt.ui.edit.text.java.rename.element"),
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(ALT+SHIFT+R,
ParameterizedCommand(Command(org.eclipse.ui.edit.rename,Rename,
Rename the selected item,
Category(org.eclipse.ui.category.file,File,null,true),
WorkbenchHandlerServiceHandler("org.eclipse.ui.edit.rename"),
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
!ENTRY org.eclipse.egit.ui 2 0 2023-03-28 17:13:40.500
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\Danie'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
!SESSION 2023-03-30 23:46:39.505 -----------------------------------------------
eclipse.buildId=4.26.0.20221201-1200
java.version=17.0.6
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product
!ENTRY ch.qos.logback.classic 1 0 2023-03-30 23:46:40.764
!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized.
!ENTRY ch.qos.logback.classic 1 0 2023-03-30 23:46:41.885
!MESSAGE Logback config file: E:\JAVA 2023\Assignment2_2230026071\.metadata\.plugins\org.eclipse.m2e.logback\logback.2.1.0.20221015-0744.xml
!ENTRY org.eclipse.jface 2 0 2023-03-30 23:46:44.371
!MESSAGE Keybinding conflicts occurred. They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2023-03-30 23:46:44.371
!MESSAGE A conflict occurred for CTRL+SHIFT+T:
Binding(CTRL+SHIFT+T,
ParameterizedCommand(Command(org.eclipse.jdt.ui.navigate.open.type,Open Type,
Open a type in a Java editor,
Category(org.eclipse.ui.category.navigate,Navigate,null,true),
WorkbenchHandlerServiceHandler("org.eclipse.jdt.ui.navigate.open.type"),
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(CTRL+SHIFT+T,
ParameterizedCommand(Command(org.eclipse.lsp4e.symbolinworkspace,Go to Symbol in Workspace,
,
Category(org.eclipse.lsp4e.category,Language Servers,null,true),
WorkbenchHandlerServiceHandler("org.eclipse.lsp4e.symbolinworkspace"),
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
!SUBENTRY 1 org.eclipse.jface 2 0 2023-03-30 23:46:44.371
!MESSAGE A conflict occurred for ALT+SHIFT+R:
Binding(ALT+SHIFT+R,
ParameterizedCommand(Command(org.eclipse.jdt.ui.edit.text.java.rename.element,Rename - Refactoring ,
Rename the selected element,
Category(org.eclipse.jdt.ui.category.refactoring,Refactor - Java,Java Refactoring Actions,true),
WorkbenchHandlerServiceHandler("org.eclipse.jdt.ui.edit.text.java.rename.element"),
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(ALT+SHIFT+R,
ParameterizedCommand(Command(org.eclipse.ui.edit.rename,Rename,
Rename the selected item,
Category(org.eclipse.ui.category.file,File,null,true),
WorkbenchHandlerServiceHandler("org.eclipse.ui.edit.rename"),
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
!ENTRY org.eclipse.egit.ui 2 0 2023-03-30 23:46:47.576
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\Danie'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.

View File

@@ -0,0 +1,12 @@
public class Start {
public static void main(String[] args) {
Code.testCode();
Assignment.testAssignment();
Student.testStudent();
Teacher.testTeacher();
}
}

View File

@@ -0,0 +1,12 @@
public class Start {
public static void main(String[] args) {
//Code.testCode();
//Assignment.testAssignment();
//Student.testStudent();
Teacher.testTeacher();
}
}

View File

@@ -0,0 +1,9 @@
public class Start {
public static void main(String[] args) {
Code.testCode();
}
}

View File

@@ -0,0 +1,53 @@
public class Code {
private boolean canRun;
private boolean canCompile;
private int lines;
public Code() {
this.canRun = false;
this.canCompile = false;
this.lines = 0;
}
public Code(boolean canCompile, boolean canRun, int lines) {
this.canRun = canRun;
this.canCompile = canCompile;
this.lines = lines;
}
public boolean compile() {return this.canCompile;}
public boolean run() {return this.canRun;}
public void debug() {
}
public void coding(int lines) {
}
public int countLines() {return this.lines;}
public static void testCode() {
// Test for the first constructor,the default values both should be false.
Code code1=new Code();
System.out.println(code1.compile()==false );
System.out.println(code1.run()==false );
//Test for the second constructor,set the values
Code code2=new Code(true,false, 100);
System.out.println(code2.compile()==true );
System.out.println(code2.run()==false );
System.out.println(code2.countLines()==100);
// Test Debug.
code2.debug();
//Then code should can both compile and run.
System.out.println(code2.compile()==true );
System.out.println(code2.run()==true );
// Test Coding & countLines
code2.coding(15);
System.out.println(code2.countLines()==15);
}
}

View File

@@ -0,0 +1,11 @@
public class Start {
public static void main(String[] args) {
//Code.testCode();
//Assignment.testAssignment();
Student.testStudent();
}
}

View File

@@ -0,0 +1,54 @@
public class Code {
private boolean canRun;
private boolean canCompile;
private int lines;
public Code() {
this.canRun = false;
this.canCompile = false;
this.lines = 0;
}
public Code(boolean canCompile, boolean canRun, int lines) {
this.canRun = canRun;
this.canCompile = canCompile;
this.lines = lines;
}
public boolean compile() {return this.canCompile;}
public boolean run() {return this.canRun;}
public void debug() {
this.canRun = true;
this.canCompile = true;
}
public void coding(int lines) {
this.lines = lines;
}
public int countLines() {return this.lines;}
public static void testCode() {
// Test for the first constructor,the default values both should be false.
Code code1=new Code();
System.out.println(code1.compile()==false );
System.out.println(code1.run()==false );
//Test for the second constructor,set the values
Code code2=new Code(true,false, 100);
System.out.println(code2.compile()==true );
System.out.println(code2.run()==false );
System.out.println(code2.countLines()==100);
// Test Debug.
code2.debug();
//Then code should can both compile and run.
System.out.println(code2.compile()==true );
System.out.println(code2.run()==true );
// Test Coding & countLines
code2.coding(15);
System.out.println(code2.countLines()==15);
}
}

View File

@@ -0,0 +1,43 @@
public class Student {
//instance variables
private Assignment myAssignment = null;
private boolean honest = true;
private String name;
//constructor
public Student(String name, boolean honest) {
this.name = name;
this.honest = honest;
}
//methods
public Assignment getAssignment(){return this.myAssignment;}
public void writeAssignment(Assignment a) {this.myAssignment = a;}
public void copyAssignment(Assignment a) {
if(a.getName() != this.name) {this.myAssignment = a;}
}
public String getName() {return this.name;}
//test
public static void testStudent() {
Assignment a1=new Assignment(null,true,"xiaoxue");
//create 2 students to test
Student stu1=new Student("xiaoxue",true);
Student stu2=new Student("xiaoyu",false);
System.out.println(stu1.getName()=="xiaoxue");
System.out.println(stu2.getName()=="xiaoyu");
//Student1 Write assignment
stu1.writeAssignment(a1);
//get Student1's assignment
Assignment assignment1=stu1.getAssignment();
//Student2 Copy that assignment
stu2.copyAssignment(assignment1);
//stu2's name should NOT be equal with the name variable in the copied assignment object
System.out.println((stu2.getName()==assignment1.getName())==false);
}
}

View File

@@ -0,0 +1,64 @@
public class Teacher {
//instance variable
private String name;
//constructor
public Teacher(String name) {
this.name = name;
}
//method
public int grading(Student s) {
if(s.getAssignment() == null) return 0;
if(s.getAssignment().getName() != s.getName()) return 0;
if(s.getAssignment().isSubmitted() == false) return 0;
if(s.getAssignment().getCode().compile() == false) return 0;
if(s.getAssignment().getCode().run() == false) return 50;
if(s.getAssignment().getCode().countLines() < 100) return 80;
else return 100;
}
//test
public static void testTeacher() {
//set one teacher named xyz
Teacher t1=new Teacher("xyz");
//tests for grading
//4 kinds of code
Code code1=new Code(true,true, 50);
Code code2=new Code(true,false,120);
Code code3=new Code();
Code code4=new Code(true,true, 120);
//set 6 different students
//not submit,score 0
Assignment a1=new Assignment(code1,false,"abin");
Student stu1=new Student("abin",true);
stu1.writeAssignment(a1);
System.out.println(t1.grading(stu1)==0);
//Copying ,score 0
Student stu2=new Student("huanfeng",false);
stu2.copyAssignment(a1);
System.out.println(t1.grading(stu1)==0);
//submitted , cannot compile, score 0
Assignment a2=new Assignment(code3,true,"Potter");
Student stu3=new Student("potter",true);
stu3.writeAssignment(a2);
System.out.println(t1.grading(stu3)==0);
//submitted , can compile, cannot run ,score 50
Assignment a3=new Assignment(code2,true,"Ron");
Student stu4=new Student("Ron",true);
stu4.writeAssignment(a3);
System.out.println(t1.grading(stu4)==50);
//submitted , can compile, can run, code lines <100 ,score 80
Assignment a4=new Assignment(code1,true,"Lupin");
Student stu5=new Student("Lupin",true);
stu5.writeAssignment(a4);
System.out.println(t1.grading(stu5)==80);
//submitted , can compile, can run, code lines >100 ,score 100
Assignment a5=new Assignment(code4,true,"Hermione");
Student stu6=new Student("Hermione",true);
stu6.writeAssignment(a5);
System.out.println(t1.grading(stu6)==100);
}
}

View File

@@ -0,0 +1,10 @@
public class Start {
public static void main(String[] args) {
//Code.testCode();
Assignment.testAssignment();
}
}

View File

@@ -0,0 +1,17 @@
public class Student {
//instance variables
private Assignment myAssignment = null;
private boolean honest = true;
private String name;
//constructor
public Student(String name, boolean honest) {
this.name = name;
this.honest = honest;
}
//methods
public Assignment getAssignment(){return this.myAssignment;}
}

View File

@@ -0,0 +1,9 @@
public class Start {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}

View File

@@ -0,0 +1,3 @@
eclipse.preferences.version=1
encoding=UTF-8
version=1

View File

@@ -0,0 +1,3 @@
eclipse.preferences.version=1
org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<launchPerspectives/>\r\n
preferredTargets=default,org.eclipse.lsp4e.debug.toggleBreakpointTarget\:default|org.eclipse.lsp4e.debug.toggleBreakpointTarget\:org.eclipse.lsp4e.debug.toggleBreakpointTarget|

View File

@@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.visibilityCheck=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.jdt.junit.content_assist_favorite_static_members_migrated=true

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.jdt.launching.PREF_VM_XML=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<vmSettings defaultVM\="57,org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType13,1679991015000" defaultVMConnector\="">\r\n <vmType id\="org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType">\r\n <vm id\="1679991015000" name\="jre" path\="C\:\\Users\\Danie\\.p2\\pool\\plugins\\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.6.v20230204-1729\\jre"/>\r\n </vmType>\r\n</vmSettings>\r\n

View File

@@ -0,0 +1,9 @@
content_assist_number_of_computers=17
content_assist_proposals_background=255,255,255
content_assist_proposals_foreground=0,0,0
eclipse.preferences.version=1
org.eclipse.jdt.ui.formatterprofiles.version=22
spelling_locale_initialized=true
typefilter_migrated_2=true
useAnnotationsPrefPage=true
useQuickDiffPrefPage=true

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.jsch.core.hasChangedDefaultWin32SshHome=true

View File

@@ -0,0 +1,2 @@
areThereWebServices=false
eclipse.preferences.version=1

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.m2e.discovery.pref.projects=

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
knownEEFragments=

View File

@@ -0,0 +1,5 @@
SWITCH_PERSPECTIVE_ON_PROJECT_CREATION=always
eclipse.preferences.version=1
platformState=1677130608974
quickStart=false
tipsAndTricks=true

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.ui.navigator.ProjectExplorer.filterActivation=\:org.eclipse.jdt.java.ui.filters.HidePackageDeclaration\:org.eclipse.jdt.java.ui.filters.HideOutputFolder\:org.eclipse.buildship.ui.navigator.filter.gradle.subProject\:org.eclipse.ui.navigator.resources.nested.HideTopLevelProjectIfNested\:org.eclipse.buildship.ui.navigator.filter.gradle.buildfolder\:org.eclipse.jdt.java.ui.filters.HideEmptyInnerPackages\:org.eclipse.jst.j2ee.navigator.ui.filters.jetemitters\:org.eclipse.jdt.java.ui.filters.HideInnerClassFiles\:org.eclipse.ui.navigator.resources.filters.startsWithDot\:org.eclipse.jdt.java.ui.filters.HideEmptyLibraryContainers\:org.eclipse.jdt.java.ui.filters.HideImportDeclaration\:org.eclipse.jdt.java.ui.filters.HideSyntheticMembers\:org.eclipse.ui.navigator.resources.nested.HideFolderWhenProjectIsShownAsNested\:

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
showIntro=false

View File

@@ -0,0 +1,10 @@
//org.eclipse.ui.commands/state/org.eclipse.ui.navigator.resources.nested.changeProjectPresentation/org.eclipse.ui.commands.radioState=false
//org.eclipse.ui.commands/state/org.eclipse.wst.xml.views.XPathView.processor.xpathprocessor/org.eclipse.ui.commands.radioState=xpath10
PLUGINS_NOT_ACTIVATED_ON_STARTUP=;org.eclipse.m2e.discovery;
eclipse.preferences.version=1
org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_END=255,255,255
org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_START=255,255,255
org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_TEXT_COLOR=16,16,16
org.eclipse.ui.workbench.ACTIVE_TAB_BG_END=255,255,255
org.eclipse.ui.workbench.ACTIVE_TAB_BG_START=255,255,255
org.eclipse.ui.workbench.INACTIVE_TAB_BG_START=242,242,242

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
processedSchemes=,eclipse+mpc,eclipse+command

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/Question1/src/Start.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="Start"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Question1"/>
</launchConfiguration>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchHistory>
<launchGroup id="org.eclipse.debug.ui.launchGroup.debug">
<mruHistory>
<launch memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;launchConfiguration local=&quot;true&quot; path=&quot;Start&quot;/&gt;&#13;&#10;"/>
</mruHistory>
<favorites/>
</launchGroup>
<launchGroup id="org.eclipse.debug.ui.launchGroup.profile">
<mruHistory/>
<favorites/>
</launchGroup>
<launchGroup id="org.eclipse.eclemma.ui.launchGroup.coverage">
<mruHistory>
<launch memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;launchConfiguration local=&quot;true&quot; path=&quot;Start&quot;/&gt;&#13;&#10;"/>
</mruHistory>
<favorites/>
</launchGroup>
<launchGroup id="org.eclipse.ui.externaltools.launchGroup">
<mruHistory/>
<favorites/>
</launchGroup>
<launchGroup id="org.eclipse.debug.ui.launchGroup.run">
<mruHistory>
<launch memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;launchConfiguration local=&quot;true&quot; path=&quot;Start&quot;/&gt;&#13;&#10;"/>
</mruHistory>
<favorites/>
</launchGroup>
</launchHistory>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>.org.eclipse.egit.core.cmp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>

View File

@@ -0,0 +1,4 @@
INDEX VERSION 1.131+E:\JAVA 2023\Assignment2_2230026071\.metadata\.plugins\org.eclipse.jdt.core
911535316.index
1865797976.index
2805711536.index

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<dirs>
<entry loc="C:\Users\Danie\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.6.v20230204-1729" stamp="1677130291646"/>
<entry loc="C:\Users\Danie\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.6.v20230204-1729\jre" stamp="1677130291646"/>
</dirs>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<libraryInfos>
<libraryInfo home="C:\Users\Danie\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.6.v20230204-1729" version="17.0.6"/>
<libraryInfo home="C:\Users\Danie\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.6.v20230204-1729\jre" version="17.0.6"/>
</libraryInfos>

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<typeInfoHistroy/>

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<qualifiedTypeNameHistroy/>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
<item key="org.eclipse.jdt.ui.last.selected.jre.kind2" value="0"/>
<item key="org.eclipse.jdt.ui.last.selected.execution.enviroment" value="JavaSE-17"/>
<item key="org.eclipse.jdt.ui.last.selected.create.moduleinfo.comments" value="false"/>
<item key="org.eclipse.jdt.ui.last.selected.create.moduleinfo" value="false"/>
<section name="org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart">
<item key="group_libraries" value="true"/>
<item key="layout" value="2"/>
<item key="rootMode" value="1"/>
<item key="linkWithEditor" value="false"/>
<item key="memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#x0D;&#x0A;&lt;packageExplorer group_libraries=&quot;1&quot; layout=&quot;2&quot; linkWithEditor=&quot;0&quot; rootMode=&quot;1&quot; workingSetName=&quot;Aggregate for window 1679990995692&quot;&gt;&#x0D;&#x0A;&lt;customFilters userDefinedPatternsEnabled=&quot;false&quot;&gt;&#x0D;&#x0A;&lt;xmlDefinedFilters&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.StaticsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.buildship.ui.packageexplorer.filter.gradle.buildfolder&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonSharedProjectsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.internal.ui.PackageExplorer.EmptyInnerPackageFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.m2e.MavenModuleFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.buildship.ui.packageexplorer.filter.gradle.subProject&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.ClosedProjectsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.EmptyLibraryContainerFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.PackageDeclarationFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.pde.ui.BinaryProjectFilter1&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.LocalTypesFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.pde.ui.ExternalPluginLibrariesFilter1&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.FieldsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonJavaProjectsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer_patternFilterId_.*&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.SyntheticMembersFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.ContainedLibraryFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.internal.ui.PackageExplorer.HideInnerClassFilesFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.DeprecatedMembersFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.ImportDeclarationFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonJavaElementFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.LibraryFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.CuAndClassFileFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.internal.ui.PackageExplorer.EmptyPackageFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonPublicFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;/xmlDefinedFilters&gt;&#x0D;&#x0A;&lt;/customFilters&gt;&#x0D;&#x0A;&lt;/packageExplorer&gt;"/>
</section>
<section name="OptionalMessageDialog.hide.">
<item key="org.eclipse.jdt.ui.typecomment.deprecated" value="true"/>
</section>
<section name="NewClassWizardPage">
<item key="create_constructor" value="false"/>
<item key="create_unimplemented" value="true"/>
</section>
<section name="completion_proposal_size">
</section>
<section name="quick_assist_proposal_size">
</section>
</section>

View File

@@ -0,0 +1,3 @@
2023-03-28 16:09:55,384 [Worker-5: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read.
2023-03-28 17:13:40,491 [Worker-7: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read.
2023-03-30 23:46:47,566 [Worker-8: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update.

View File

@@ -0,0 +1,41 @@
<configuration scan="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>OFF</level> <!-- change to DEBUG to mimic '-consolelog' behaviour -->
</filter>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${org.eclipse.m2e.log.dir}/0.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<FileNamePattern>${org.eclipse.m2e.log.dir}/%i.log</FileNamePattern>
<MinIndex>1</MinIndex>
<MaxIndex>10</MaxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>10MB</MaxFileSize>
</triggeringPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
</appender>
<appender name="EclipseLog" class="org.eclipse.m2e.logback.appender.EclipseLogAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
</appender>
<appender name="MavenConsoleLog" class="org.eclipse.m2e.logback.appender.MavenConsoleAppender">
</appender>
<root level="INFO">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
<appender-ref ref="EclipseLog" />
<appender-ref ref="MavenConsoleLog" />
</root>
</configuration>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<setup:Workspace
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:setup="http://www.eclipse.org/oomph/setup/1.0"
name="workspace"/>

View File

@@ -0,0 +1,2 @@
#Cached timestamps
#Thu Mar 30 23:47:08 CST 2023

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
</section>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
<section name="NewWizardAction">
<item key="NewWizardSelectionPage.STORE_SELECTED_ID" value="org.eclipse.jdt.ui.wizards.JavaProjectWizard"/>
<list key="NewWizardSelectionPage.STORE_EXPANDED_CATEGORIES_ID">
</list>
</section>
<section name="ChooseWorkspaceDialogSettings">
<item key="DIALOG_X_ORIGIN" value="357"/>
<item key="DIALOG_Y_ORIGIN" value="219"/>
</section>
<section name="WORKBENCH_SETTINGS">
<list key="ENABLED_TRANSFERS">
</list>
</section>
</section>

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<state reopen="false"/>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
</section>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<workingSetManager>
<workingSet editPageId="org.eclipse.jdt.internal.ui.DynamicSourcesWorkingSet" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1679990993182_0" label="Java Main Sources" name="Java Main Sources"/>
<workingSet editPageId="org.eclipse.jdt.internal.ui.DynamicSourcesWorkingSet" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1679990993193_1" label="Java Test Sources" name="Java Test Sources"/>
<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1679990995692_2" label="Window Working Set" name="Aggregate for window 1679990995692"/>
</workingSetManager>

View File

@@ -0,0 +1,3 @@
#Thu Mar 30 23:46:41 CST 2023
org.eclipse.core.runtime=2
org.eclipse.platform=4.26.0.v20221123-1800

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Question1</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@@ -0,0 +1,47 @@
public class Assignment {
//instance variables
private Code myCode;
private int score;
private boolean submitted;
private String name;
//constructor
public Assignment(Code myCode, boolean submitted, String name) {
this.myCode = myCode;
this.submitted = submitted;
this.name = name;
}
//methods
public void submit() {this.submitted = true;}
public boolean isSubmitted() {return this.submitted;}
public int getScore() {return this.score;}
public void setScore(int score) {this.score = score;}
public String getName() {return this.name;}
public Code getCode() {return this.myCode;}
//test
public static void testAssignment() {
// Test for the constructor
Code code0=new Code();
Assignment a0=new Assignment(code0,false,"xiaoyu");
System.out.println(a0.getName()=="xiaoyu");
System.out.println(a0.isSubmitted()==false);
//Test for code
//the default code can not be run
System.out.println(a0.getCode().run()==false);
//Test for submit
a0.submit();
System.out.println(a0.isSubmitted()==true);
//Test for score
a0.setScore(15);
System.out.println(a0.getScore()==15);
}
}

View File

@@ -0,0 +1,58 @@
public class Code {
//instance variables
private boolean canRun;
private boolean canCompile;
private int lines;
//constructors
public Code() {
this.canRun = false;
this.canCompile = false;
this.lines = 0;
}
public Code(boolean canCompile, boolean canRun, int lines) {
this.canRun = canRun;
this.canCompile = canCompile;
this.lines = lines;
}
//methods
public boolean compile() {return this.canCompile;}
public boolean run() {return this.canRun;}
public void debug() {
this.canRun = true;
this.canCompile = true;
}
public void coding(int lines) {
this.lines = lines;
}
public int countLines() {return this.lines;}
//test
public static void testCode() {
// Test for the first constructor,the default values both should be false.
Code code1=new Code();
System.out.println(code1.compile()==false );
System.out.println(code1.run()==false );
//Test for the second constructor,set the values
Code code2=new Code(true,false, 100);
System.out.println(code2.compile()==true );
System.out.println(code2.run()==false );
System.out.println(code2.countLines()==100);
// Test Debug.
code2.debug();
//Then code should can both compile and run.
System.out.println(code2.compile()==true );
System.out.println(code2.run()==true );
// Test Coding & countLines
code2.coding(15);
System.out.println(code2.countLines()==15);
}
}

View File

@@ -0,0 +1,11 @@
public class Start {
public static void main(String[] args) {
Code.testCode();
Assignment.testAssignment();
Student.testStudent();
Teacher.testTeacher();
}
}

View File

@@ -0,0 +1,44 @@
public class Student {
//instance variables
private Assignment myAssignment = null;
private boolean honest = true;
private String name;
//constructor
public Student(String name, boolean honest) {
this.name = name;
this.honest = honest;
}
//methods
public Assignment getAssignment(){return this.myAssignment;}
public void writeAssignment(Assignment a) {this.myAssignment = a;}
public void copyAssignment(Assignment a) {
//if the names are different
if(a.getName() != this.name) {this.myAssignment = a;}
}
public String getName() {return this.name;}
//test
public static void testStudent() {
Assignment a1=new Assignment(null,true,"xiaoxue");
//create 2 students to test
Student stu1=new Student("xiaoxue",true);
Student stu2=new Student("xiaoyu",false);
System.out.println(stu1.getName()=="xiaoxue");
System.out.println(stu2.getName()=="xiaoyu");
//Student1 Write assignment
stu1.writeAssignment(a1);
//get Student1's assignment
Assignment assignment1=stu1.getAssignment();
//Student2 Copy that assignment
stu2.copyAssignment(assignment1);
//stu2's name should NOT be equal with the name variable in the copied assignment object
System.out.println((stu2.getName()==assignment1.getName())==false);
}
}

View File

@@ -0,0 +1,71 @@
public class Teacher {
//instance variable
private String name;
//constructor
public Teacher(String name) {
this.name = name;
}
//method
public int grading(Student s) {
//if no assignment submitted
if(s.getAssignment() == null) return 0;
//if the student copied
if(s.getAssignment().getName() != s.getName()) return 0;
//if submitted not on time
if(s.getAssignment().isSubmitted() == false) return 0;
//if cannot compile
if(s.getAssignment().getCode().compile() == false) return 0;
//if cannot run
if(s.getAssignment().getCode().run() == false) return 50;
//if code lines < 100
if(s.getAssignment().getCode().countLines() < 100) return 80;
//code lines >= 100
else return 100;
}
//test
public static void testTeacher() {
//set one teacher named xyz
Teacher t1=new Teacher("xyz");
//tests for grading
//4 kinds of code
Code code1=new Code(true,true, 50);
Code code2=new Code(true,false,120);
Code code3=new Code();
Code code4=new Code(true,true, 120);
//set 6 different students
//not submit,score 0
Assignment a1=new Assignment(code1,false,"abin");
Student stu1=new Student("abin",true);
stu1.writeAssignment(a1);
System.out.println(t1.grading(stu1)==0);
//Copying ,score 0
Student stu2=new Student("huanfeng",false);
stu2.copyAssignment(a1);
System.out.println(t1.grading(stu1)==0);
//submitted , cannot compile, score 0
Assignment a2=new Assignment(code3,true,"Potter");
Student stu3=new Student("potter",true);
stu3.writeAssignment(a2);
System.out.println(t1.grading(stu3)==0);
//submitted , can compile, cannot run ,score 50
Assignment a3=new Assignment(code2,true,"Ron");
Student stu4=new Student("Ron",true);
stu4.writeAssignment(a3);
System.out.println(t1.grading(stu4)==50);
//submitted , can compile, can run, code lines <100 ,score 80
Assignment a4=new Assignment(code1,true,"Lupin");
Student stu5=new Student("Lupin",true);
stu5.writeAssignment(a4);
System.out.println(t1.grading(stu5)==80);
//submitted , can compile, can run, code lines >100 ,score 100
Assignment a5=new Assignment(code4,true,"Hermione");
Student stu6=new Student("Hermione",true);
stu6.writeAssignment(a5);
System.out.println(t1.grading(stu6)==100);
}
}