CISC 3115
Modern Programming Techniques
Labs Home Page
List of Labs
About the Labs
- The labs are meant to supplement the corresponding lecture
- The content of the lab will be closely tied to the material covered in the corresponding lecture.
- You are responsible for the lab even if you miss that class.
- Feel free to copy/paste the files included with the lecture as a starting point for your lab.
- You may NOT however cut and paste from any other source, than than your own notes and/or code
- In particular, copying code from another student, and/or website, and/or any other source will result in a 0 for the entire
lab, and will be reported to the college Academic Integrity Committee.
Working on the Labs
- You should develop your lab solutions using the development environment of your choice (i.e, an IDE such as Eclipse, NetBeans, Dr Java, etc;
or an editor, such as vi, and the command line compiler/interpreter).
- Once you've got the lab 'working', you should submit it to CodeLab for checking and possible approval.
- 'Working' means:
- Compiles without compilation errors
- Executes to completion (i.e., no crashes, or other runtime error / exceptions)
- The answers are correct — you should be determining this by:
- 'eyeballing' your output (i.e., looking at it and seeing if the answers are correct.
- In addition, the description of each exercise on the Lab page will often contain one or more test runs which
show the prompts, inputs, and corresponding correct output for the exercise.
- The input is in bold — to distinguish it from what your program prints (pronpts
and output). When you rn your program, you will not be seeing the input in bold.
- There's not much point in submitting it to CodeLab before that.
- The labs are collaborative in the sense that you should feel free to discuss them with other people in the class.
- You should also feel free to look at other's code, but not copy it.
The Output Displayed for the Exercises
Exercises will often be accompanied by the details of one or more test runs. The purpose of these are to:
- Give you some sense of what the program does and what's it's execution looks like.
- Provide information so your program can be successfully submitted to CodeLab. For these lab exercises, CodeLab compares your program's
output with the 'correct' output expected for the exercises.
- It is therefore imperative that the text of your program's prompts and output exactly match that expected by CodeLab
- In order for you to be able to do this, you need to know:
- The expected order of user input
- For example, is the last name entered followed by the first name? or vice versa?
- The exact text of the prompts
- For example, is the expected prompt
Enter a number:
, or Please type in a #
?
- The exact text of the output produced
- For example, is the expected output
Gerald Weiss has an average of 80
or "Weiss, Gerald: 80?
- The test run provides you with all this information.
- In the illustrative test runs, user input is in bold to distinguish it from the text output by your program (prompts and output)
- When you are running your program, your user input will not appear in bold.
Motivation for Each Lab Exercise
- At the end of each lab is a small section explaining the purpose or goal of the lab; i.e., what you hopefully will gain
from completing the exercise.
- It may be simply practice of a new feature or technique, or some challenging problem to make you think, or a new technique
Submitting the Lab Exercises to Codelab
Once you're satisfied that your program 'works', you should submit it to CodeLab:
- Open the course, and go to the corresponding lab under the
Labs
topic.
- Paste your solution (from Dr Java) into the submission box
- What happens if CodeLab complains about you failing test cases:
- Not every test case used by CodeLab will be presented on the Lab page.
- It may very well be that your code produces correct output for the test cases you see on the page, but fail other test cases
used by CodeLab
- This will be particularly likely if you code toward the test, i.e., you write your solution based on
the test cases you see (as opposed to coding a general solution based on the problem description).
- One or more of the lab exercises in a Lab may be marked for 'Approval', which means that even once it passes CodeLab's tests, it will remain
in a pending state until I look at your submission (for style, comments,etc).
About Grading ← Important!
- Exercises are either correct or not.
- If they are marked as correct, you get full credit for the exercise; there is no numeric grade
- If the exercise is not marked as correct, you essentially get no credit for it, any partial credit is solely at my discretion
- partial credit assigns a percentage of a fully credited exercise
- 'not correct' includes:
- never attempted
- attempted but did not pass CodeLab
- this includes failing at compilation, failing all test cases, failing some test cases, failing due to a runtime error
- an approval that passed CodeLab but was rejected by me
- In the event of incorrect, I may assign partial credit depending on how close to a correct answer you came
- The essential idea is that in a working environment a partially correct program would never be released to the general population
- You should not get into the habit of thinking that a program 'almost' works
About Deadlines and 'Freeze' Dates ← Important!
Labs will be associated with lectures …
- when a lecture first appears on the calendar, the corresponding lab will be posted in the Class Calendar.
- once the lecture has been completed, the lab will be assigned a deadline; typically two to three weeks from that date.
- submissions beyond the due date will be marked as late.
- one week beyond the due date, the exercise will be frozen
- submissions past the frozen date will not be entered in the roster — however, you can still work on them for your own benefit
Again, all these dates will be posted in the Calendar
Only labs submitted to CodeLab are considered; there is no other mechanism for submitting your work.
'Approval' Exercises
- Some exercises may be labelled as requiring 'Approval' both on the lab page as well as so marked in Codelab.
- Approval exercises require my approval (in addition to the usual Codelab 'correctness' checking).
- You cannot submit the exercise for approval until it has passed Codelab's tests.
- Once the exercise is deemd 'correct' by Codelab, you submit the exercise for approval using the corresponding button
on the workspace area.
- CodeLab accepting the exercise does NOT automatically submit it for approval; you must do that yourself.
- I will then accept or reject the exercise; in the latter case, I will specify what I found unacceptable.
- Once you have passed the CodeLab check, the deadline is no longer relevant; i.e., even if I reject the exercise and ask for resubmission, you will
not be penalized.
Exercises are marked for Approval for several reasons:
- I want to check your style / indentation / documentation
- This is especially true at the beginning of the course
- The exercise involves something that can't be checked by Codelab
- For example, if I ask for a specific sort algorithm; Codelab can only check that the arrays has been sorted, but not how
A Note on the Output Displayed by CodeLab
- If your submission fails CodeLabs tests, you will be presented with your output as well as the expected output
- What you will see is only the text printed by your program (and the corresponding output of
a 'correct' solution).
- In particular, you will NOT see the user input, as it was supplied by the user, and not printed by your program.
- As an example. Given the following program that prompts the user for their last and first names and prints a greeting of the form
Hello first name last name!!
import java.util.*;
public class Hello {
public static void main(String [] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter last name: "); // prompt
String lastName = scanner.next();
System.out.print("Enter first name: "); // prompt
String firstName = scanner.next();
System.out.println("Hello " + firstName + " " + lastName + "!!"); // output
}
}
- Here is what the execution would look like if you ran the program (notice — no bold):
Enter last name: Weiss
Enter first name: Gerald
Hello Gerald Weiss!!
- Here is what how the execution is displayed on the lab page (as well as in the CodeLab instructions for the exercise (notice the bold):
Enter last name: Weiss
Enter first name: Gerald
Hello Gerald Weiss!!
- In both of the above cases, you see the user input entered from the keyboard. But the actual output produced by the program
(i.e., the output produced from the
print
or println
messages sent to System.out
) is actually:
Enter last name: Enter first name: Hello Gerald Weiss!!
- Notice the absence of any of the user input (that was not printed by the program's
print
message)
- This is what CodeLab will display as your program's output (it will also display similar user-inputless
output for the expected output).
- This takes a bit getting used to, but since both your output and the expected output are displiayed this way
it should not be too difficult for you to find the discrepancies.
How CodeLab Provides Feedback on Console and File Output
Note: The following display has changed a bit, but the essence is still the same.
- If the exercise involves writing output to standard output or a file, errors made in that output will result in the following feedback:
- Scroll down to the bottom of the page (below the "Your Submission" window — or use the arrow to collapse that window),
where you will find the Test Case Table where at least one of the test cases will be incorrect:
- Click the which will bring up the Output Comparason Table:
- The text in
red strikeout (fals
in the above example) highlights incorrect text in your output, i.e., text that should not be
there (or at least not in the location it appears). You need to fix your program so that this is NOT displayed
- The text in green underline (tru
in the above example) displays missing text in your output, i.e., text that should be at the specified
location but is not present in your output. You need to fix your program so that this IS displayed