Advertisement
Crenox

Cheating Java Program

Feb 2nd, 2016
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. // Sammy Samkough
  2. // Description: To show how not getting caught cheating is synonmous (technically) to not even cheating at all
  3.  
  4. public class Cheating
  5. {
  6. public Cheating()
  7. {
  8. /* no parameters */
  9. }
  10.  
  11. public boolean didYouCheat(boolean ifCheating)
  12. {
  13. // if you do cheat
  14. if(ifCheating == true)
  15. {
  16. ifCheating = true;
  17. }
  18. // if you don't cheat
  19. else
  20. {
  21. ifCheating = false;
  22. }
  23.  
  24. return ifCheating;
  25. }
  26. }
  27. ----------------------------------------------------------------------------------------------------------------------------------
  28. // Sammy Samkough
  29. // Description: To show how not getting caught cheating is synonmous (technically) to not even cheating at all
  30.  
  31. public class CheatingRunner
  32. {
  33. public static void main(String args[])
  34. {
  35. Cheating c = new Cheating();
  36.  
  37. String story = "";
  38. boolean cheat;
  39.  
  40. story = "A student is taking a test. A student cheats on the test by looking at someone else's paper, " +
  41. "but no one saw him. No teacher, no other student, nothing. He got the good grade a week later, it was " +
  42. "an A. Now, since no one saw him, did he still cheat?";
  43. System.out.println(story);
  44. cheat = false;
  45. System.out.println("Did the person cheat?" + cheat);
  46.  
  47. System.out.println(c.didYouCheat(cheat));
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement