CSCI 222: Programming Concepts & Problem Solving II
Spring 2018

Course Assignments




zyBooks Assignments

CH2: Due 1/24 CH2,CH3,4: Due 1/31
CH5: Due 2/7 CH6: Due 2/14
CH7: Due 2/21 CH8: Due 3/14
CH9: Due 3/21 CH10: Due 3/28
CH11: Due 4/4 CH12: Due 4/11
NOTE: this is a proposed schedule, check back for updates!

Programming Assignments

Programming Assignment 1: Hamming Distances

Assigned: 1/12
Due: 1/29 by email before the start of class

Libraries you may use:

  • iostream

What you need for Wednesday part 1 checkin (1/17):
Start a new project with the provided code stub, get one function working. I would suggest the length() function. Make sure you can demonstrate your function during the lab period.
What you need for Wednesday part 2 checkin (1/24):
Make sure you have one more function (for a total of 2) working. Be able to demonstrate your functions during the lab period.



The Hamming Distance between two strings is the number of positions in the strings where the corresponding character is different. In this first assignment you will be prompting the user for two strings, computing the Hamming Distance between them, and then reporting the result to the user.

Traditionally, Hamming Distances are only computed between strings of the same length. Our program is going to be a bit more flexible, and count differences in string length towards Hamming Distance. For example: The difference between "per" and "person" will be 3.

For your first assignment, I have provided a general program structure, including stubs for each function you will need. If you wish, you may write additional helper functions to solve the problem, though you are not required to do so.

You can download the program outline here: distance.cpp. NOTE: does not always open correctly in Microsoft Edge/IE, instead use Chrome.

A sample run of your program should match the following:

Please enter string 1: per
Please enter string 2: person
per and person are 3 characters apart

A second sample run:
Please enter string 1: apple
Please enter string 2: pineapple
apple and pineapple are 9 characters apart

NOTE: for this last example we are not matching the first string to the "apple" part of "pineapple", and instead just looking from the beginning of both strings. This is a more difficult problem and beyond the scope of this class.

What to turn in:

  • distance.cpp: A valid C++ file containing all of your code.

BONUS

  • (2 points) Implement a loop which allows the user to check multiple strings in a single run.