601.107 Introduction to Programming in Java
Homework 1 - due by 11:30pm on Tuesday 9/12

Overview

The goal of this assignment is to work through the first two phases of programming by developing sample runs, pseudocode, and a subroutine breakdown for three different problems.

We strongly suggest that you create a folder on your personal computer for this course. Within that folder, you should create a sub-folder for each future homework assignment. This will make homework submission go much smoother in the future, by grouping together all the files for a particular assignment.

Deliverables: Submit one pdf file of your typed up answers to all three parts A-C on Blackbaord, with each part clearly marked as "Part A", "Part B", etc. Since this is (ungraded) homework that might be reviewed publicly in class, do not put any identifying personal information in the files you submit. Blackboard keeps track of your submissions so we will know who did it.


Part A: Making Change Sample Run

Design a sample run for a program that helps the user to convert a small monetary amount into change in US coins: quarters, dimes, nickels and pennies. The input should be some amount less than $5.00. The output should be the total number of coins in each denomination required to create the equivalent dollar amount. Assume that the highest value coins will be used as much as possible. For example, making change for $3.71 would require 14 quarters, 2 dimes, 0 nickels and 1 penny. You must submit three sample runs that are the same with respect to the structure/prompts/etc, but use different input amounts to illustrate various cases that a change making program would need to handle.

Part B: Digit String Description Pseudocode

Write pseudocode for an algorithm that will get a string of digits as input, and then output a new string which "describes" the previous one using only digits. The description is based on sub-sequences of all the same digit. For example, if the initial string is "2211134433341", the descriptive string result would be "22311324331411". This is shorthand for "two 2s, three 1s, one 3, two 4s, three 3s, one 4, and one 1. Note that if there are multiple sequences of a particular digit (such as 3, 4 and 1 in this example), they do not get combined together. Try to be as detailed as possible, including statements that capture all the work that would be done in order to solve the problem on paper, but do not write Java (or other programming language) code!

Remember that we write pseuducode to solve a problem for *any* input. Even though it is not required, you should probably do a few different examples to get a feel for how to solve the problem generally. For example, what is the description for input "33333"? What's the description of "1332222" or "676767"? Once you write your pseudocode, see if a friend can follow it to get the right answer without knowing the problem ahead of time.

Part C: Sudoku Breakdown

Suppose you were designing an interactive program to let a user solve a Sudoku puzzle. See https://en.wikipedia.org/wiki/Sudoku for a description of the game. A program to let a user play a game can have lots of different features and interfaces. (As examples, you can find web versions and mobile apps to play the game.) Describe the overall operation of your proposed program in a few sentences. Then identify at least 3 subroutines that would be needed in order to break the programming solution down into smaller chunks. Write a sentence explaining each subroutine.


General assignment requirements, style and submission details: