首页 > > 详细

辅导 EECS2101、讲解 Java编程设计

EECS2101 -Winter 2024- Lab01
Due Date: Sunday, January 28, 2024, before 11:59 PM.
Page 1 of 9
Contents
Instructions: .................................................................................................................................... 2
Important Reminders.................................................................................................................. 2
Academic Honesty ...................................................................................................................... 2
Learning Outcomes and Objectives................................................................................................ 3
Lab Learning Objective................................................................................................................ 3
Important pre-lab work you need to do before going to the lab................................................... 4
Getting Started................................................................................................................................ 4
Lab Structure................................................................................................................................... 5
Lab Restrictions:.............................................................................................................................. 6
Lab Exercise..................................................................................................................................... 7
A recursive helper method ......................................................................................................... 7
Infer Class and Method Specifications from JUnit Tests ............................................................ 8
Submit your work by using the course eClass................................................................................ 9
Submission Requirements: Header Comments.......................................................................... 9
Check List: ................................................................................................................................... 9
Submit The Following File:.......................................................................................................... 9
EECS2101 -Winter 2024- Lab01
Due Date: Sunday, January 28, 2024, before 11:59 PM.
Page 2 of 9
Instructions:
Important Reminders • You can submit your lab work in eClass any time before 23:59 on Sunday (January 28,
2024) of the week the lab is due. Your last submission will overwrite the previous ones,
and only the last submission will be graded.
• The deadline is strict, with no excuses: you receive 0 for not making your electronic
submission in time. Emailing your solutions to the instructors or TAs will not be
acceptable.
• To submit your work, you need to use the York eClass.
• Your submission will be graded by JUnit tests given to you (if any) and additional JUnit
tests covering some other input values. This is to encourage you to take more
responsibility for the correctness of your code by writing more JUnit tests.
• Developing and submitting a correct solution for this lab without compilation errors is
essential. Hence, you must take a reasonable amount of time to test your code in
different ways. If you submitted a solution with a small mistake in terms of syntax or do
not comply with lab instructions, then you may receive a 0 as a grade for the
implementation of this lab.
• There will be a 40% penalty on your lab final grade if your submitted code does not
compile due to minor compilation errors, given that TAs can fix these minor
compilation errors. You will receive a zero if your code contains major compilation
errors that TAs cannot fix.
Academic Honesty • Students are expected to read the Senate Policy on Academic Honesty. See also the
EECS Department Academic Honesty Guidelines.
• All labs are to be completed individually; no group work is allowed. Do not discuss
solutions with anyone other than the instructor. Do not copy or look at specific
solutions from the net. If you are repeating the course, you cannot submit the solution
you developed in previous terms or for other purposes. You should start from scratch
and follow the instructions.
EECS2101 -Winter 2024- Lab01
Due Date: Sunday, January 28, 2024, before 11:59 PM.
Page 3 of 9
Learning Outcomes and Objectives This lab's purpose is to implement various recursive methods without using any loop statements.
This programming lab aims to provide students with a comprehensive understanding of recursion
and problem-solving techniques. Throughout the lab, you will grasp the fundamental concepts
of recursion, including its definition, base cases, and termination conditions.
You will learn to design and implement recursive solutions by breaking down intricate problems
into smaller manageable subproblems and then combining their solutions to solve the larger
challenge. This lab will enable you to cultivate a recursive mindset and recognize recurring
patterns in various problems. Through practical exercises, you will gain proficiency in designing
and debugging recursive functions, working with strings and numbers, and applying recursive
thinking to real-world scenarios. Additionally, you will enhance your critical thinking abilities by
analyzing problem requirements and evaluating solution efficiency.
Lab Learning Objective
• Designing recursive algorithms.
• Construct recursive solutions to given problems.
• Correctly implement base cases and recursive cases.
• Debugging recursive programs.
• Testing your code thoroughly using JUnit test cases.

EECS2101 -Winter 2024- Lab01
Due Date: Sunday, January 28, 2024, before 11:59 PM.
Page 4 of 9
Important pre-lab work you need to do before
going to the lab a. http://wiki.eclipse.org/The_Official_Eclipse_FAQs
b. Testing using Eclipse IDE
a. Video: Java Unit Testing with JUnit - Tutorial - How to Create And Use
Unit Tests
c. Read about debugging using Eclipse IDE
a. https://www.eclipse.org/community/eclipse_newsletter/2017/june/artic
le1.php
b. Video: How to set breakpoints to debug code in Java using Eclipse Debug
mode
c. Video: How To Debug Java Code The Right Way - Eclipse Debugger Full
Tutorial
Feel free to find online resources on these and share them with your classmate on the discussion
forum
Getting Started
1. Start Eclipse.
2. Download the starter code "Lab1.zip" from the eClass course site
3. Import the test project by doing the following:
1. Under the File menu, choose Import...
2. Under General, choose Existing Projects into Workspace and press Next
3. Click the Select archive file radio button, and click the Browse... button. You may
have to wait about 10 seconds before the file browser appears.
4. In the file browser that appears, navigate to your home directory.
5. Select the file Lab1.zip and click OK
6. Click Finish.
4. All files you need for this lab should now appear in Eclipse.

EECS2101 -Winter 2024- Lab01
Due Date: Sunday, January 28, 2024, before 11:59 PM.
Page 5 of 9
Lab Structure
After successfully importing the starter code/project "Lab1.zip"
The lab folder/directory structure is as follows:
• src/lab1/: directory contains Java files: RecursiveMethods.java.
• src/lab1/: directory contains Java files (JUnit test cases):
JunitTest_RecursiveMethods.java. These files contain several JUnit test cases that can
help to test your code.
It should be noted that you need to run the JUnit tester
JunitTest_RecursiveMethods.java after you complete the RecursiveMethods.java class
to check your work. Nonetheless, passing all given tests does not guarantee full marks
for this lab. Therefore, you are required to write additional tests to ensure the
correctness of your implementations.
• doc/: directory contains Java documentation for the lab in HTML format. You'll see there
is a file called index.html. Clicking on this file shows the lab/project documentation in your
browser.
You do not have to include JavaDoc comments.
EECS2101 -Winter 2024- Lab01
Due Date: Sunday, January 28, 2024, before 11:59 PM.
Page 6 of 9
Lab Restrictions:
• IMPORTANT: In this lab, you are NOT allowed to use any
kind of loop statement (such as for-loop or white-loop).
Violating this requirement will result in a mark of zero.
• For the JUnit test cases, the class JunitTest_RecursiveMethods.java given to you.
o Do not modify the test methods given to you.
o You are allowed to add new test cases by creating new test methods.
• For each method which you are required to implement, derived from the JUnit test
methods:
o No System.out.println statements should appear in it.
o No Scanner operations (e.g., input.nextInt()) should appear in it.
Instead, declare the method's input parameters as indicated by the JUnit tests.
• You are NOT allowed to add any "import" statement other than those already given in
the starter files.

EECS2101 -Winter 2024- Lab01
Due Date: Sunday, January 28, 2024, before 11:59 PM.
Page 7 of 9
Lab Exercise
A recursive helper method
You may consider adding private recursive helper methods for some of the public recursive
methods in the RecursiveMethods class.
For example, the method fibArray can be implemented using a private recursive method like
so:
public int[] fibArray(int n) {
if(n == 2) {
int[] seq = {1, 1};
return seq;
}
else {
int[] seq = new int[n];
seq[0] = 1;
seq[1] = 1;
fibArrayHelper(2, seq); // fibArrayHelper recursively fills in the rest of seq
return seq;
}
}
private void fibArrayHelper(int i, int[] seq) {
//recursively fills in seq starting at index i
}
EECS2101 -Winter 2024- Lab01
Due Date: Sunday, January 28, 2024, before 11:59 PM.
Page 8 of 9
Infer Class and Method Specifications from JUnit Tests
You may have noticed that the above "overview" descriptions are not as precise as the class
specifications and method implementations. In fact, unlike the previous labs, we will not provide
detailed specifications in this handout. To obtain the precise specification, you need to carefully
analyze the test cases in the provided JUnit tests to understand the expected behaviors of each
method.
In professional software development, test cases often play a vital role in specifying software
requirements. This is called Test-Driven Development (TDD). Read more about it here:
https://en.wikipedia.org/wiki/Test-driven_development.

EECS2101 -Winter 2024- Lab01
Due Date: Sunday, January 28, 2024, before 11:59 PM.
Page 9 of 9
Submit your work by using the course eClass
Submission Requirements: Header Comments
To ensure proper identification and authenticity of your work, every file you submit for this lab
assignment must include specific information in the form of comments at the top of the file. This
information is crucial for assessing your work and must be included in every file you submit.
Each file must start with a comment section containing the following details:
• Full Name: Your complete name as registered in the course.
• Yorku Email: Your official York University email address.
• Date: The date when you completed the work on the file.
• Authenticity Declaration: A statement declaring the authenticity of your submission.
Here is the format you should use:

//Full Name : [Your Full Name]
//Yorku Email : [Your Yorku Email]
//Date : [Date of Completion]
//Authenticity Declaration:
//I declare this submission is the result of my own work and has not been
//shared with any other student or 3rd party content provider. This submitted
//piece of work is entirely of my own creation.

Check List: Before submitting your files for this lab, you must ensure you completed the following.
There is No compilation error generated from your implementation for this lab.
The RecursiveMethods.java file contains the implementation for this lab.
Submit The Following File:
1) You need to submit one file, RecursiveMethods.java.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!