Mastermind with objects: Fall 2026
Learning Objective(s)
- Learn to create, use and test simple classes
Overview of the Program
Modify the previous program so that it uses classes
Specifics
- The main program is called MasterMindGame and should not need modifying.
- There is a class called Response. You may used it. It should not need modifying.
- There is no file i/o for this program.
- You will need to write a Pattern class. That stores a solution/guess. The data should be stored in an integer array.
- It will need to support the methods classed from the main program.
- Use what was discussed in class to help plan the field variable and methods for the Pattern class.
- It needs a constant to represent the number of different colors available.
- You need to write a unit tester for the Response class. Call it TestResponse.
- you may use the solution from the previous lab
Sample dialogue
This has not changed
Lab Hints
none
Submission
- Create a software development report
- For the system design, you need to make your own flowchart.
- For testing report,
- make sure your tests ensure that each statement is executed at least one.
- your expected output CANNOT be pasted from the dialogue of a running. Only the actual output may be pasted.
- you also need to refer to your TestResponse testing
- It should contain at least one different input that is an "error"
- For the improvement section, specify how many points were lost from the last lab that you should not lose points for on this lab because you corrected the problem
- create a pdf document from your software development report
- create an empty zip folder
- place your two files (Pattern.java and TestResponse.java) in the zip folder. If you have modified any of my code, only then should you place them in the zip folder.
- place your pdf document into it (with a complete UML diagram for all three classes (not the Test programs))
- submit the zip folder on canvas
Optional improvements
Optional improvements should ONLY be worked on once the program is completing working. In addition, the work is to be done on your own with little if any help for lab assistants or the instructor.
- Only allow the user to enter a valid guess (correct number of pegs and allowed colors)
- Output the number of guesses it took to get the right answer. At the end of the program, output the average number of guesses over all the games played.
- Submission instructions
- Any code that is modified should be changed to have the class end in a 2. Include the original code and the new code in the zip folder. Be sure to include appropriate testing data in your sdr for your extra credit
This topic: CenterForComputing
> WebHome >
Syllabi >
CSC121SylF2026 > CSC121F2026Lab13
Topic revision: r1 - 2026-06-04 - CathyBareiss