Z
zero
After an idea pitched by someone here (I don't remember who, sorry),
I've created this template for homework help. Changing the class or
method names breaks the code, and so does adding or removing lines above
the catch block, making it hard to pass this off as the student's own
work. And if they do succeed in changing it enough, I think they
deserve to pass ;-) Of course the code specific to the assignment
should have some pitfalls too, so they can't just copy and paste into
their own class.
Yes, I have too much time on my hands.
import java.lang.reflect.Method;
import java.math.BigInteger;
public class DoYourHomeworkYourself
{
\u0073\u0074\u0061\u0074\u0069\u0063
\u0053\u0074\u0072\u0069\u006E\u0067
\u006E\u0061\u006D\u0065\u003D\u0020
\u0022\u0044\u006F\u0059\u0022\u002B
\u0022\u006F\u0075\u0072\u0048\u0022
\u002B\u0022\u006F\u006D\u0022\u002B
\u0022\u0065\u0077\u006F\u0072\u0022
\u002B\u0022\u006B\u0059\u006F\u0022
\u002B\u0022\u0075\u0072\u0073\u0022
\u002B\u0022\u0065\u006C\u0066\u0022
\u003B\u000A\u000C\u0009\u0020\u0020
\u0073\u0074\u0061\u0074\u0069\u0063
\u0053\u0074\u0072\u0069\u006E\u0067
\u006D\u006E\u0061\u006D\u0065\u003D
\u0022\u0072\u0075\u006E\u0048\u0022
\u002B\u0022\u006F\u006D\u0065\u0022
\u002B\u0022\u0077\u006F\u0072\u0022
\u002B\u0022\u006B\u0022\u003B\u000C
\u0073\u0074\u0061\u0074\u0069\u0063
\u0053\u0074\u0072\u0069\u006E\u0067
\u0070\u006E\u0061\u006D\u0065\u003D
\u0022\u0072\u0075\u006E\u0022\u003B
\u0073\u0074\u0061\u0074\u0069\u0063
\u0053\u0074\u0072\u0069\u006E\u0067
\u0072\u006E\u0061\u006D\u0065\u003D
\u0022\u007F\u0071\u0052\u0022\u003B
static String num = "\u0034\u0039";
public void run()
{
System.out.println("thanks to comp.lang.java.programmer");
}
public static void main(String args[]) throws Exception
{
try
{
Class aClass = Class.forName(name);
Object anObject = aClass.newInstance();
Method method1 = aClass.getMethod(mname, (Class[])null);
method1.invoke(anObject, (Object[])null);
Method method2 = aClass.getMethod(pname, (Class[])null);
method2.invoke(anObject, (Object[])null);
Method method3 = aClass.getMethod(rname, (Class[])null);
method3.invoke(anObject, (Object[])null);
}
catch(Exception e)
{
if(e.getStackTrace()[1].getLineNumber()
!= new BigInteger(num).intValue())
throw new Error("Don't tamper with my code");
}
}
public void runHomework()
{
System.out.println("homework specific code goes here");
}
}
I've created this template for homework help. Changing the class or
method names breaks the code, and so does adding or removing lines above
the catch block, making it hard to pass this off as the student's own
work. And if they do succeed in changing it enough, I think they
deserve to pass ;-) Of course the code specific to the assignment
should have some pitfalls too, so they can't just copy and paste into
their own class.
Yes, I have too much time on my hands.
import java.lang.reflect.Method;
import java.math.BigInteger;
public class DoYourHomeworkYourself
{
\u0073\u0074\u0061\u0074\u0069\u0063
\u0053\u0074\u0072\u0069\u006E\u0067
\u006E\u0061\u006D\u0065\u003D\u0020
\u0022\u0044\u006F\u0059\u0022\u002B
\u0022\u006F\u0075\u0072\u0048\u0022
\u002B\u0022\u006F\u006D\u0022\u002B
\u0022\u0065\u0077\u006F\u0072\u0022
\u002B\u0022\u006B\u0059\u006F\u0022
\u002B\u0022\u0075\u0072\u0073\u0022
\u002B\u0022\u0065\u006C\u0066\u0022
\u003B\u000A\u000C\u0009\u0020\u0020
\u0073\u0074\u0061\u0074\u0069\u0063
\u0053\u0074\u0072\u0069\u006E\u0067
\u006D\u006E\u0061\u006D\u0065\u003D
\u0022\u0072\u0075\u006E\u0048\u0022
\u002B\u0022\u006F\u006D\u0065\u0022
\u002B\u0022\u0077\u006F\u0072\u0022
\u002B\u0022\u006B\u0022\u003B\u000C
\u0073\u0074\u0061\u0074\u0069\u0063
\u0053\u0074\u0072\u0069\u006E\u0067
\u0070\u006E\u0061\u006D\u0065\u003D
\u0022\u0072\u0075\u006E\u0022\u003B
\u0073\u0074\u0061\u0074\u0069\u0063
\u0053\u0074\u0072\u0069\u006E\u0067
\u0072\u006E\u0061\u006D\u0065\u003D
\u0022\u007F\u0071\u0052\u0022\u003B
static String num = "\u0034\u0039";
public void run()
{
System.out.println("thanks to comp.lang.java.programmer");
}
public static void main(String args[]) throws Exception
{
try
{
Class aClass = Class.forName(name);
Object anObject = aClass.newInstance();
Method method1 = aClass.getMethod(mname, (Class[])null);
method1.invoke(anObject, (Object[])null);
Method method2 = aClass.getMethod(pname, (Class[])null);
method2.invoke(anObject, (Object[])null);
Method method3 = aClass.getMethod(rname, (Class[])null);
method3.invoke(anObject, (Object[])null);
}
catch(Exception e)
{
if(e.getStackTrace()[1].getLineNumber()
!= new BigInteger(num).intValue())
throw new Error("Don't tamper with my code");
}
}
public void runHomework()
{
System.out.println("homework specific code goes here");
}
}