Question: Homework 6 In this homework assignment, you'll complete two Java programs ( described below ) . You will turn in your code by pushing it

Homework 6
In this homework assignment, you'll complete two Java programs (described below). You will turn in your code by pushing it to GitHub. If you do not remember how to do this, refer to the instructions in Lab 2.
In this assignment, you're not actually writing a new program. You already have the spec, you've already written a solution, and you've already ensured that it works. Awesome!
In this assignment, you're going to do what's called refactoring. Refactoring is taking code that's already written and making it better somehow. In this case, you're going to take two programs that are made up of only a main() function (the Word Guessing Game from the last assignment and the Flag program from the assignment before last) and refactor them to have many functions that work together.
Part 1: REFACTORING THE FLAG
Writing code to print a flag without the use of functions or arrays was really tough! But now we have those tools, so how might the logic be simplified/organized/made more readable? It's your task to find out!
A file of function stubs has been provided for you. (A function "stub" is what programmers call a full function definition/description with an empty function body.) Each function stub includes JavaDoc comments explaining what the function should do. Read the comments carefully and implement the functions accordingly.
You must fill in the logic for the functions provided and use those functions in the execution of the program. You may not omit any of the provided functions. You may add/use additional static functions if you wish.
A good strategy would be starting with the simplest function first (getFilledInGrid), then moving on to the next simplest (getStarOfSize), etc.
The function printFlagOfSize will likely be the most complicated. It relies on every other function (either directly or indirectly). Don't start trying to perfect it until all the other functions are written and working.
Part 2: REFACTORING THE WORD GUESSING GAME
A barebones file for your refactored Word Guessing Game has been provided for you, but you will need to design and implement many more functions. The most difficult part of this assignment is breaking up the problem into convenient and logical pieces, so don't rush into a program design if you haven't thought it through!
In this refactor, you may add as many static functions as you like. At minimum, though, your refactored code should include functions for:
controlling the gameplay of a single game
fetching a random word of a specified length
getting and validating a guess from the user
updating the hint (if necessary) given a user guess
determining whether the game is over (returns a Boolean)
determining whether the user won or lost
and, of course, a very brief main.
Each function (in both programs) needs to have appropriate JavaDoc comments.
Homework 6 Objectives
Functions: Appropriately split code into functions according to the single responsibility principle, correctly utilizing parameters and return values.
Systems Design: Create systems that demonstrate knowledge of top-down design and exhibit code reading capabilities.
Meets Spec: Write software that meets provided requirements and specifications.
Code Mechanics: Choose appropriate data types and structures, use those types and structures effectively, and continue to make good choices over time.
Code Style: Write code in an industry-standard coding style.
Software Engineering Skills: Produce software by following industry-standard practices, including code reading, use of remote repositories, and software testing.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!