YCP Logo Assignment 1: Making Change

Due: Tuesday, February 2nd by 11:59 PM

Getting Started

Start by downloading CS101_Assign1.zip, saving it in the directory H:\CS101.

Start a Cygwin Bash Shell and run the following commands:

cd h:
cd CS101
unzip CS101_Assign1.zip
cd CS101_Assign1

Using Notepad++, open the file

H:\CS101\CS101_Assign1\Coins.cpp

You will add your code to this file.

Run the command

make

when you are ready to compile the program. To run the program, run the command

./Coins.exe

Your Task

Your task is to write a program that prompts the user to enter an amount of money in cents, and prints out the number of whole dollars, quarters, dimes, nickels, and pennies that would be required to make change for that amount.

Here is an example run of the program (user input in bold):

How many cents? 237
Here is your change:
  Dollars: 2
  Quarters: 1
  Dimes: 1
  Nickels: 0
  Pennies: 2

Your program should generate change with the smallest total number of dollars and coins possible. For example, it would not correct to make change for 23 cents with 23 pennies.

Hints

Start by just having the program determine the number of whole dollars. (Integer division will be useful.)

Once the program can determine the number of whole dollars, you can use that information to determine the number of quarters. Then, when the numbers of dollars and quarters are known, the number of dimes can be determined, and so forth.

Submitting

To submit your work, make sure your Coins.cpp file is saved, and type the command

make submit

Enter your Marmoset username and password (which you should have received by email.) Note that your password will not be echoed to the screen. Make sure that after you enter your username and password, you see a message indicating that the submission was successful.

Important: Make sure that you check the file(s) you submitted to ensure that they are correct. Log into the server using the following URL:

https://camel.ycp.edu:8443/view/course.jsp?coursePK=61

You should see a list of labs and assignments. In the row for assign1, click the link labeled view. You will see a list of your submissions. Download the most recent one (which should be listed first). Verify that it contains the correct files.

You are responsible for making sure that your submission contains the correct file(s).