MCIS-4135
Homework Assignment 3
This assignment will give you experience with control logic in a main program, as well as beginning an orientation to object-oriented programming and problem solving skills.
For the programming assignment, please hand in a hardcopy listing of your code, in a readable, legible, easy to evaluate form, along with the output that your program generates. If your program doesn’t compile for any reason, hand in the error listing from your compiler as the output.
For the essay portions, make your write-ups easy to understand, and concise.
(Based on Deitel and Deitel, page 236, problem 5.29) Legend has it that in 1626 Peter Minuit purchased Manhattan for $24 in barter. Did he make a good investment? To answer this question, modify the compound interest program (found below) to begin with a principal of $24 and calculate the amount on deposit if that money had been invested with interest rates of 2%, 3%, 5%, and 7% to observe the wonders of compound interest.
A car and a train are both traveling toward a railroad crossing on a collision course. The train is 1200 feet from the crossing and traveling at a constant speed of 40 feet per second. The car is 1500 feet away and traveling at 55 feet per second. Write a program to calculate and print each vehicles distance from the crossing at one-second intervals. If the car gets to the crossing first, print "Made it." If the train gets to the crossing first, print "Crash".
Consider how one would calculate the worth of Manhattan real estate today, and write a short paragraph including your thoughts, a first-order estimate, and the source of any data you used to calculate it. Internet or other reference materials are acceptable.
Think about being a real estate land manager in Manhattan. You buy abandoned lots, demolish and clean up the buildings on them, keep track of your inventory, and then sell the lots to developers. Describe at least 3 real-world-things (objects) in this problem space, including the details (attributes) that are important to your business.
The code for problem (1) above is as follows:
// Adapted from D&D, Fig 5.6: fig05_06.cpp
// Compound interest calculations with “for”
#include <iostream>
using std::cout;
using std::endl;
using std::fixed;
#include <iomanip>
using std::setw;
using std::setprecision;
int main() {
double principal = 1000.00;
double rate = 0.02; // 2%
double amount;
cout << “Year” << setw(21) << “Amount on deposit” << endl;
cout << fixed << setprecision(2);
amount = principal;
for (int year=1; year <= 10; year++) {
amount = amount * (1.0 + rate);
cout << setw(4) << year << setw(21) << amount << endl;
}
return 0;
}
For problem 3, remember that this is not a coding exercise, but an exercise in constructing an algorithmic approach and gathering data for that approach.
Code will be evaluated both for proper style and for correct content.
Essays will be evaluated for ease of understanding and clarity.
40 |
Part 1: Was Manhattan a good deal? |
30 |
Part 2: Car versus train |
20 |
Part 3: How much is Manhattan worth? |
10 |
Part 4: Analysis of a real estate business |