CMSC 104, Section 01, Fall 2016
Problem Solving and Computer Programming

Project 2

Due Date: Thursday, October 6th @ 5:30 PM

Point Value: This project is graded with a 25 point max score.


To become more familiar with:

Problems 1-3 are problem solving and algorithm problems. For each of these three problems, complete two parts:
  1. solve the problem as stated, and
  2. give a generic algorithm for solving the problem.

The answers to problems 1-3 should be typed into a file named campusid_proj2.txt in pseudocode. Use a similar format to the one in the Algorithms II lecture. You DO NOT need to write C code for problems 1-3.

  1. (5 points) Determine the dollar value of a coin collection that contains 13 pennies, 2 nickels, 4 dimes, 7 quarters, and 5 silver dollars.

  2. (5 points) You have been saving dimes and nickels in your piggy bank (everything counts). After counting 150 total coins, you know that you have $9.45. How many of each coin do you have?

  3. (5 points) Bob loans Bill $0.01 (one penny) under the condition that for every day that Bill does not pay Bob back, the amount that Bill owes Bob doubles (x2). If Bill does not pay Bob back, how many days go by before Bill owes Bob over $1,000,000.00?

  4. Hints for problems 1-3:

  5. (10 points) Write a C program, called campusid_hello.c, that prompts the user to input three initials, scans the three initials, and then outputs "Hello, XYZ!", where X,Y, and Z are the three input initials, respectively. Your program should be well formatted and documented with the necessary information to identify it as yours in the header comment. See the C Coding Standards for more details.

    • You only need a total of one scanf and two printf calls!
    • You can print/scan the value of more than one variable in a single printf/scanf call.
    • Check the third slide of the Algorithms II lecture for more help with scanf and printf. The textbook is also helpful.
    • DO NOT cut and paste from Microsoft Word or other text editors into your terminal window! They use non-standard characters that confuse gcc. I will explain more in class.

    Compile campusid_hello.c with the "gcc" compiler. Execute your program to verify that it works correctly.

When you have finished, submit your campusid_proj2.txt and campusid_hello.c files using the following two commands:

curl -L -F file=@campusid_proj2.txt

curl -L -F file=@campusid_hello.c

Additionally, email your campusid_proj2.txt and campusid_hello.c files as an attachment to using the subject line Project Submission - 2 - Lastname, Firstname, replacing Lastname, Firstname with your name.

Last Modified: October 5th, 2016 12:25 AM