Difference between revisions of "Submitting Java Programs to Moodle"

From dftwiki3
Jump to: navigation, search
 
Line 36: Line 36:
 
<br />
 
<br />
 
* Normally, there won't be a limit on the number of submissions, so feel free to go back to the program, edit it, and re-evaluate it.  If nothing works, you may want to go back to beowulf2 and work there.
 
* Normally, there won't be a limit on the number of submissions, so feel free to go back to the program, edit it, and re-evaluate it.  If nothing works, you may want to go back to beowulf2 and work there.
 +
<br />
 +
 +
==Be Careful of Extra Space Characters!==
 +
<br />
 +
Look at the evaluation results below.  It is for a program written in assembly language, not Java, but you could get the exact same problem in Java:
 +
<br />
 +
<center>[[Image:MoodleSubmission5.png|400px]]</center>
 +
<br />
 +
It seems that the output of the program matches the expected output, but for some reason, Moodle rejects the program...  Why? 
 +
<br />
 +
Take a closer look at the image to see if you see the problem...
 +
<br />
 +
The answer is illustrated in the image below:
 +
<br />
 +
<center>[[Image:MoodleSubmission6.png|400px]]</center>
 +
<br />
 +
The program  '''outputs an extra blank line.'''  Very likely it has an extra number ''System.out.println()'' statement somewhere Removing it will solve the problem and make the program pass, with a 100/100 grade.
 +
<br />
 +
 +
 +
 +
 +
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 
<br />
 
<br />
  

Latest revision as of 20:29, 10 September 2014

--D. Thiebaut (talk) 12:02, 9 September 2014 (EDT)



  • Login to Moodle and pick the CSC212 link
  • Locate the Lab 2 activity in Week 2, Click on it.


212 moodle 1.png


  • Note the information about the submission, and in particular the deadline (usually a week after you start on it).


212 moodle 2.png


  • Click on the Edit Tab and copy/paste or type in your Java solution for the Lab. Make sure the name of the class is the same as the name of the file containing it. So, for this example, the class name is Lab2 (with an uppercase L), and the file name is Lab2.java.


212 moodle 3.png


  • Click on Save to save your program in Moodle
  • Click on Run to verify that your program runs correctly. A console window will open and show the program output.


212 moodle 4.png


If you have errors, correct them and repeat the previous 2 steps
  • Once you are satisfied your program runs correctly, close the console window and click on Evaluate:


212 moodle 5.png


If everything ran smoothly, your program output matches that of the solution program, and you get a 100/100 grade, and a message indicating that your program passed 1 test out of 1. (In the future, your program may get tested with several different inputs).
  • If your program output is not correct, then the Virtual Programming Lab module of Moodle will give you some indications:
    • The grade is 0/100
    • The correct output is shown
    • The output of your program is shown (and we can see the problem: a dash instead of a space)
    • A message indicating that your program failed 1 test out of 1.


212 moodle 6.png


  • Normally, there won't be a limit on the number of submissions, so feel free to go back to the program, edit it, and re-evaluate it. If nothing works, you may want to go back to beowulf2 and work there.


Be Careful of Extra Space Characters!


Look at the evaluation results below. It is for a program written in assembly language, not Java, but you could get the exact same problem in Java:

MoodleSubmission5.png


It seems that the output of the program matches the expected output, but for some reason, Moodle rejects the program... Why?
Take a closer look at the image to see if you see the problem...
The answer is illustrated in the image below:

MoodleSubmission6.png


The program outputs an extra blank line. Very likely it has an extra number System.out.println() statement somewhere Removing it will solve the problem and make the program pass, with a 100/100 grade.