Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. public class VideoGame {
  2. private int score;
  3. private String name;
  4. private String difficulty;
  5.  
  6. public VideoGame() {
  7. this.score = 0;
  8. this.name = "name";
  9. this.difficulty = "difficulty";
  10. }
  11. public VideoGame(String name, String difficulty) {
  12. this.score = score;
  13. this.name = name;
  14. this.difficulty = difficulty;
  15. }
  16.  
  17. public void setScore(int gameScore) {
  18. this.score = gameScore;
  19.  
  20. }
  21. public void setName(String playerName) {
  22. this.name = playerName;
  23. }
  24. public void setDifficulty(String hardness) {
  25. this.difficulty = hardness;
  26. }
  27. public int getScore() {
  28. return this.score;
  29. }
  30. public String getName() {
  31. return this.name;
  32. } public String getDifficulty() {
  33. return this.difficulty;
  34. }
  35.  
  36. public boolean checkGame(VideoGame game1, VideoGame game2) {
  37. boolean checker = false;
  38. if(game1.equals(game2)) {
  39. checker = true;
  40. }
  41.  
  42. return checker;
  43.  
  44.  
  45. }
  46. public void checkScore(VideoGame game, int score1) {
  47.  
  48. if(score1 > score) {
  49. game.setScore(score1);
  50.  
  51.  
  52.  
  53. }
  54.  
  55.  
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement