Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please complete the last part of this code PlayGame.java in JAVA language. GameSettings.java public class GameSettings { private int levels; private int hardTopicsPerLevel; private int
Please complete the last part of this code PlayGame.java in JAVA language.
GameSettings.java
public class GameSettings { private int levels; private int hardTopicsPerLevel; private int projectsPerLevel; public GameSettings() { this.levels = 12; this.hardTopicsPerLevel = 4; this.projectsPerLevel = 5; } public int getLevels() { return levels; } public int getHardTopicsPerLevel() { return hardTopicsPerLevel; } public int getProjectsPerLevel() { return projectsPerLevel; } @Override public String toString() { return "Levels:" + levels + " " + "Hard Topics Per Level:" + hardTopicsPerLevel + " " + "Projects Per Level:" + projectsPerLevel + " "; } public int levelsChange(int val) { this.levels = levels + val; return levels; } public int topicsChange(int val) { this.hardTopicsPerLevel = hardTopicsPerLevel + val; return hardTopicsPerLevel; } public int projectsChange(int val) { this.projectsPerLevel = projectsPerLevel + val; return projectsPerLevel; } }
Student.java
public class Student { private String name; private String university; private int hasdTopicsMastered; private int projectsCompleted; private boolean graduated; private double careerTime; public Student(String name, String university, int hasdTopicsMastered, int projectsCompleted, boolean graduated, double careerTime) { this.name = name; this.university = university; this.hasdTopicsMastered = hasdTopicsMastered; this.projectsCompleted = projectsCompleted; this.graduated = graduated; this.careerTime = careerTime; } public String getName() { return name; } public String getUniversity() { return university; } public int getHasdTopicsMastered() { return hasdTopicsMastered; } public int getProjectsCompleted() { return projectsCompleted; } public boolean isGraduated() { return graduated; } public double getCareerTime() { return careerTime; } public void setHasdTopicsMastered(int hasdTopicsMastered) { this.hasdTopicsMastered = hasdTopicsMastered; } public void setProjectsCompleted(int projectsCompleted) { this.projectsCompleted = projectsCompleted; } public void setGraduated(boolean graduated) { this.graduated = graduated; } public void roundCareerTime(double careerTime) { int temp = (int) Math.round(careerTime); double dif = careerTime - temp; if (dif >= 0.5) { dif = 0.5; } else { dif = 0; } this.careerTime = temp + dif; } @Override public String toString() { String s = "Name:" + name + " " + "University:" + university + " " + "Hard Topics Mastered:" + hasdTopicsMastered + " " + "Projects Completed:" + projectsCompleted + " "; s = s + "Graduated:" + isGraduated() + " " + "Career Time:" + careerTime + "years "; return s; } }
Level.java
public class Level { private int levelNumber; private String description; private String difficulty; private int acedTests; private int hardTopicsIncomplete; private int regularProjectsIncomplete; private int capStonesProjectsIncomplete; private double time; private boolean passed; public Level(int levelNumber, int acedTests, int hardTopicsIncomplete, int regularProjectsIncomplete, int capStonesProjectsIncomplete, double time) { super(); this.levelNumber = levelNumber; this.description = getDescription(levelNumber); this.difficulty = getDifficulty(levelNumber); this.acedTests = acedTests; this.hardTopicsIncomplete = hardTopicsIncomplete; this.regularProjectsIncomplete = regularProjectsIncomplete; this.capStonesProjectsIncomplete = capStonesProjectsIncomplete; this.time = time; if ((hardTopicsIncomplete + regularProjectsIncomplete > 2) || (capStonesProjectsIncomplete > 0)) this.passed = false; else this.passed = true; } public String getDescription(int levelNumber) { String s; switch (levelNumber) { case 1: s = "Object obriented program and Problem Solving"; break; case 2: s = "Programming in C"; break; case 3: s = "Computer Architecture"; break; case 4: s = "Data Structures and Algorithms"; break; case 5: s = "Systems Programming"; break; case 6: s = "Software Engineering I"; break; case 7: s = "Compilers"; break; case 8: s = "Operating Systems"; break; case 9: s = "Introduction to Analysis and Algorithms"; break; case 10: s = "Data Mining and Machine Learning"; break; case 11: s = "Software Testing"; break; case 12: s = "Software Engineering II"; break; default: s = "Diabolical Software Engineering Course"; break; } return s; } public String getDifficulty(int levelNumber) { if (levelNumber = 5 && levelNumber = 9 && levelNumberoutput 1:
output2:
PlayGame.java PlayGame will include all the logic used to actually play the game. This class must have a main method, though you are allowed to add additional methods if you like. Output samples are provided in the next section. Match the output exactly. The Starter Code includes all of the prompts you will need. During gameplay, users will be prompted to enter their information and customization options. After that data is used to configure the game, they will be prompted to enter the data for each level until they quit or graduate. For each level, players will enter the number of aced tests, topics not understood, regular projects incomplete, capstone projects incomplete, and time taken. Note: You must create each of the classes and implement them as described in their respective sections. Failure to do so will negatively impact your score. Welcome to Students of CS! Good luck with your college career! Enter your name: [John] Enter your university: [Purdue University] Would you like to customize the number of levels? [no] Would you like to customize the number of hard topics per level? [no] Would you like to customize the number of projects per level? [no] Enter the number of aced tests in level 1: [1] Enter the number of topics not understood in level 1: [0] Enter the number of regular projects incomplete in level 1: [0] Enter the number of capstone projects incomplete in level 1: [0] Enter the time taken in level 1: [0.3] Enter the number of aced tests in level 2: [2] Enter the number of topics not understood in level 2: [3] Enter the number of regular projects incomplete in level 2: [0] Enter the number of capstone projects incomplete in level 2: [0] Enter the time taken in level 2: [0.4] Enter the number of aced tests in level 3: [3] Enter the number of topics not understood in level 3: [1] Enter the number of regular projects incomplete in level 3: [0] Enter the number of capstone projects incomplete in level 3: [1] Enter the time taken in level 3: [0.2] General information about the failed level is as follows: Level Number: 3 Description: Computer Architecture Difficulty: Easy Would you like to play level 3 again? [no] --- Now displaying information about the student Name: John University: Purdue University Hard Topics Mastered: 8 Projects Completed: 14 Graduated: false Career Time: 1.0 years Thank you for playing Students of CS! Welcome to Students of CS! Good luck with your college career! Enter your name: [Sarah] Enter your university: [University of Iowa) Would you like to customize the number of levels? [yes] Enter the number of levels to add or remove(use negative value to remove): [1] Would you like to customize the number of hard topics per level? [no] Would you like to customize the number of projects per level? [no] Enter the number of aced tests in level 1: [0] [2] Enter the number of topics not understood in level 1: Enter the number of regular projects incomplete in level 1: Enter the number of capstone projects incomplete in level 1: [@] [0] Enter the time taken in level 1: [0.4] Enter the number of aced tests in level 2: [0] Enter the number of topics not understood in level 2: [0] Enter the number of regular projects incomplete in level 2: [1] Enter the number of capstone projects incomplete in level 2: [0] Enter the time taken in level 2: [0.2] Enter the number of aced tests in level 3: [4] Enter the number of topics not understood in level 3: [0] Enter the number of regular projects incomplete in level 3: [4] Enter the number of capstone projects incomplete in level 3: [0] Enter the time taken in level 3: [0.3] Enter the number of aced tests in level 4: [0] Enter the number of topics not understood in level 4: [] Enter the number of regular projects incomplete in level 4: [] Enter the number of capstone projects incomplete in level 4: [0] Enter the time taken in level 4: [0.1] Enter the number of aced tests in level 5: [1] Enter the number of topics not understood in level 5: [1] Enter the number of regular projects incomplete in level 5: [1] Enter the number of capstone projects incomplete in level 5: [0] Enter the time taken in level 5: [0.3] Enter the number of aced tests in level 6: [1] Enter the number of topics not understood in level 6: [0] Enter the number of regular projects incomplete in level 6: [2] Enter the number of capstone projects incomplete in level 6: [0] Enter the time taken in level 6: [0.2] Enter the number of aced tests in level 7: [0] Enter the number of topics not understood in level 7: [0] Enter the number of regular projects incomplete in level 7: [0] Enter the number of capstone projects incomplete in level 7: [0] Enter the time taken in level 7: [0.4) Enter the number of aced tests in level 8: [0] [2] Enter the number of topics not understood in level 8: Enter the number of regular projects incomplete in level 8: Enter the number of capstone projects incomplete in level 8: [0] [0] Enter the time taken in level 8: [0.1] Enter the number of aced tests in level 9: [4] Enter the number of topics not understood in level 9: [0] Enter the number of regular projects incomplete in level 9: [3] Enter the number of capstone projects incomplete in level 9: [0] Enter the time taken in level 9: [0.3] Enter the number of aced tests in level 10: [0] Enter the number of topics not understood in level 10: [0] Enter the number of regular projects incomplete in level 10: [2] Enter the number of capstone projects incomplete in level 10: [0] Enter the time taken in level 10: [0.2] Enter the number of aced tests in level 11: [@] Enter the number of topics not understood in level 11: [2] Enter the number of regular projects incomplete in level 11: [1] Enter the number of capstone projects incomplete in level 11: [e] Enter the time taken in level 11: [8.4] General information about the failed level is as follows: Level Number: 11 Description: Software Testing Difficulty: Hard Would you like to play level 11 again? [yes] Enter the number of aced tests in level 11: [2] Enter the number of topics not understood in level 11: [@] Enter the number of regular projects not completed in level 11: [@] Enter the number of capstone projects not completed in level 11: [@] Enter the time taken in level 11: [0.31 Enter the number of aced tests in level 12: [2] Enter the number of topics not understood in level 12: [@] Enter the number of regular projects not completed in level 12: [@] Enter the number of capstone projects not completed in level 12: [0] Enter the time taken in level 12: [0.1] Enter the number of aced tests in level 13: [0] Enter the number of topics not understood in level 13: [2] Enter the number of regular projects not completed in level 13: [0] Enter the number of capstone projects not completed in level 13: [e] Enter the time taken in level 13: [0.41 Congratulations Sarah, you have graduated! Course Obstacles: Levels: 13 Hard Topics Per Level: 4 Projects Per Level: 5 - Now displaying information about the student --- Name: Sarah University: University of Iowa Hard Topics Mastered: 45 Projects Completed: 52 Graduated: true Career Time: 4.2 years Thank you for playing Students of CS! PlayGame.java PlayGame will include all the logic used to actually play the game. This class must have a main method, though you are allowed to add additional methods if you like. Output samples are provided in the next section. Match the output exactly. The Starter Code includes all of the prompts you will need. During gameplay, users will be prompted to enter their information and customization options. After that data is used to configure the game, they will be prompted to enter the data for each level until they quit or graduate. For each level, players will enter the number of aced tests, topics not understood, regular projects incomplete, capstone projects incomplete, and time taken. Note: You must create each of the classes and implement them as described in their respective sections. Failure to do so will negatively impact your score. Welcome to Students of CS! Good luck with your college career! Enter your name: [John] Enter your university: [Purdue University] Would you like to customize the number of levels? [no] Would you like to customize the number of hard topics per level? [no] Would you like to customize the number of projects per level? [no] Enter the number of aced tests in level 1: [1] Enter the number of topics not understood in level 1: [0] Enter the number of regular projects incomplete in level 1: [0] Enter the number of capstone projects incomplete in level 1: [0] Enter the time taken in level 1: [0.3] Enter the number of aced tests in level 2: [2] Enter the number of topics not understood in level 2: [3] Enter the number of regular projects incomplete in level 2: [0] Enter the number of capstone projects incomplete in level 2: [0] Enter the time taken in level 2: [0.4] Enter the number of aced tests in level 3: [3] Enter the number of topics not understood in level 3: [1] Enter the number of regular projects incomplete in level 3: [0] Enter the number of capstone projects incomplete in level 3: [1] Enter the time taken in level 3: [0.2] General information about the failed level is as follows: Level Number: 3 Description: Computer Architecture Difficulty: Easy Would you like to play level 3 again? [no] --- Now displaying information about the student Name: John University: Purdue University Hard Topics Mastered: 8 Projects Completed: 14 Graduated: false Career Time: 1.0 years Thank you for playing Students of CS! Welcome to Students of CS! Good luck with your college career! Enter your name: [Sarah] Enter your university: [University of Iowa) Would you like to customize the number of levels? [yes] Enter the number of levels to add or remove(use negative value to remove): [1] Would you like to customize the number of hard topics per level? [no] Would you like to customize the number of projects per level? [no] Enter the number of aced tests in level 1: [0] [2] Enter the number of topics not understood in level 1: Enter the number of regular projects incomplete in level 1: Enter the number of capstone projects incomplete in level 1: [@] [0] Enter the time taken in level 1: [0.4] Enter the number of aced tests in level 2: [0] Enter the number of topics not understood in level 2: [0] Enter the number of regular projects incomplete in level 2: [1] Enter the number of capstone projects incomplete in level 2: [0] Enter the time taken in level 2: [0.2] Enter the number of aced tests in level 3: [4] Enter the number of topics not understood in level 3: [0] Enter the number of regular projects incomplete in level 3: [4] Enter the number of capstone projects incomplete in level 3: [0] Enter the time taken in level 3: [0.3] Enter the number of aced tests in level 4: [0] Enter the number of topics not understood in level 4: [] Enter the number of regular projects incomplete in level 4: [] Enter the number of capstone projects incomplete in level 4: [0] Enter the time taken in level 4: [0.1] Enter the number of aced tests in level 5: [1] Enter the number of topics not understood in level 5: [1] Enter the number of regular projects incomplete in level 5: [1] Enter the number of capstone projects incomplete in level 5: [0] Enter the time taken in level 5: [0.3] Enter the number of aced tests in level 6: [1] Enter the number of topics not understood in level 6: [0] Enter the number of regular projects incomplete in level 6: [2] Enter the number of capstone projects incomplete in level 6: [0] Enter the time taken in level 6: [0.2] Enter the number of aced tests in level 7: [0] Enter the number of topics not understood in level 7: [0] Enter the number of regular projects incomplete in level 7: [0] Enter the number of capstone projects incomplete in level 7: [0] Enter the time taken in level 7: [0.4) Enter the number of aced tests in level 8: [0] [2] Enter the number of topics not understood in level 8: Enter the number of regular projects incomplete in level 8: Enter the number of capstone projects incomplete in level 8: [0] [0] Enter the time taken in level 8: [0.1] Enter the number of aced tests in level 9: [4] Enter the number of topics not understood in level 9: [0] Enter the number of regular projects incomplete in level 9: [3] Enter the number of capstone projects incomplete in level 9: [0] Enter the time taken in level 9: [0.3] Enter the number of aced tests in level 10: [0] Enter the number of topics not understood in level 10: [0] Enter the number of regular projects incomplete in level 10: [2] Enter the number of capstone projects incomplete in level 10: [0] Enter the time taken in level 10: [0.2] Enter the number of aced tests in level 11: [@] Enter the number of topics not understood in level 11: [2] Enter the number of regular projects incomplete in level 11: [1] Enter the number of capstone projects incomplete in level 11: [e] Enter the time taken in level 11: [8.4] General information about the failed level is as follows: Level Number: 11 Description: Software Testing Difficulty: Hard Would you like to play level 11 again? [yes] Enter the number of aced tests in level 11: [2] Enter the number of topics not understood in level 11: [@] Enter the number of regular projects not completed in level 11: [@] Enter the number of capstone projects not completed in level 11: [@] Enter the time taken in level 11: [0.31 Enter the number of aced tests in level 12: [2] Enter the number of topics not understood in level 12: [@] Enter the number of regular projects not completed in level 12: [@] Enter the number of capstone projects not completed in level 12: [0] Enter the time taken in level 12: [0.1] Enter the number of aced tests in level 13: [0] Enter the number of topics not understood in level 13: [2] Enter the number of regular projects not completed in level 13: [0] Enter the number of capstone projects not completed in level 13: [e] Enter the time taken in level 13: [0.41 Congratulations Sarah, you have graduated! Course Obstacles: Levels: 13 Hard Topics Per Level: 4 Projects Per Level: 5 - Now displaying information about the student --- Name: Sarah University: University of Iowa Hard Topics Mastered: 45 Projects Completed: 52 Graduated: true Career Time: 4.2 years Thank you for playing Students of CS
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started