122 p3
Project 3-A
Due: 21:00 F 11/2

C++ Programming:
Chess for Pennies

==> Post your P3 questions/answers to the 122 Blog.
==> Address email queries to both your Instructor and GTF for best results, and Don't Forget to put "122" in the subject line
" There are two ways to write error-free programs; only the third one works." -anon.

Project Requirements

Complete the following requirements in the order given:
  1. Read Using Visual C++.

    Read three PPT slides from a CIS 110 presentation, ch-3-binary.ppt, slides #6, #7, & #8.

    Study
    the Power of the Powers of 2.

    Review
    I/O manipulators.

  2. chessPence.cpp. Write a program that prompts the user for the number of the ending square on the chessboard, and then displays the number of pennies on each square and the sum of the pennies up to and including that square.

    I/O Specification. Using the number of the square entered by the user, your program can use a for loop to generate the powers of 2 up to (but excluding) that limit; each of these powers of 2 is a term in the sequence 1 + 2 + 4 + 8 + ...

    Generate the following I/O interface:




  3. Add an eof-controlled while loop. Save chessPence.cpp as chessPence-eof.cpp. Add an eof-controlled while loop that prompts the user like this:

    enter limit (ctrl-z to exit): 16

    <output as in #2, above>
    enter limit (ctrl-z to exit): <user enters ctrl-z, ESC>
    exiting . .


  4. Your results.

    Provide answers to the following questions in the Comments section when you submit your project in Blackboard:

    A) Do your results agree with the MathKids author statement that final value of the pennies on the chessboard is $ 368,934,881,474,191,032.32? Justify your answer.

    B) On what square of the chessboard did the cumulative amount exceed Deal #1,
    $108,256,887,912.00?

    C) Is there a single square containing an amount >= to Deal  #1? If so, what is the first square contains enough pennies to beat Deal #1?

    D) If the pennies on square 64 were placed in a single stack, how high would it be?

    E) If all the pennies on the board were placed in a single stack, how high would it be?

    Cool Facts
    A light nanosecond -- the distance light can travel in a billionth of a second -- is about 1 foot (about 30 cm). Radar uses this fact to measure how far away something like an airplane is. A radar antenna sends out a short radio pulse and then waits for it to echo off an airplane or other target. While it's waiting, it counts the number of nanoseconds that pass. Radio waves travel at the speed of light, so the number of nanoseconds divided by 2 tells the radar unit how far away the object is!

    A light-year is equal to:


  5. Project 3-B Grading Rubric. This document describes how your lab instructor (GTF) will grade your project. You should assess your project using this rubric before turning in your project. Also, this would be a good exercise for each member of your VLT: assess each other's work using this rubric before submitting it.

  6. How to Submit your Project for Grading