CSE 250 - Fall 2008 - Banner
UB -
University at Buffalo, The State University of New York Computer Science and Engineering
  • CSE 250 - Fall 2008
CSE 250 - Fall 2008 - Navigation

Homework 1
Last modified: October 07 2008 12:44:09 PM

CSE 250 - Fall 2008 - Announcements

Task 1: Get a working Environment in the Lab

If you are interested in using Eclipse, see information on getting the installed version of Eclipse to have the C++ development tools here.

If you are using another editor, make sure you know how to open it and take a moment to familiarize yourself with it.

Task 2: Make sure you know how to compile and run a file with no known errors

Copy the contents of the file located here into your editor. Compile and run it to ensure that you know how to do this. This file has no known errors and does run (however, there is a logic error in the code), so if you can not compile or run, you definitely need to take the time to figure out why it isn't working. You will not need to submit this file or modify it. However, it would be good practice to figure out when and why it does not function correctly. However, you do not need to turn anything in for this part of the assignment.

Task 3: Development of a C++ class on your own

You will develop and test a class that represents a Money object. The Money object should contain two pieces of private data, an int for dollars and an int for cents.

It should have the following constructors:

Money()
Money(int cents)
Money(int dollars, int cents)

There should be a destructor:

~Money()

There should be accessors and mutators named:

void setDollars(int dollars)
void setCents(int cents)
int getDollars()
int getCents()

There should be a function to add that takes as a parameter another Money object and returns a Money object that is the result of the addition.

Money add(Money otherAmount)

There should be a subtract function that functions similarly.

Money subtract(Money otherAmount)

There should be a function called addInterest that takes in an interest rate as a double and adds the appropriate interest to your Money object.

void addInterest(double interestRate)

You should either override the << operator for printing or write a print method for the class.

The names of your methods must follow the above exactly. To test your code, we will be writing a testing program that expects this interface. If you code doesn't work with our testing program, you will receive no credit.

You should also test your code yourself in a separate file called MoneyDriver.cpp. You should ensure that the functionality described above works properly. You will be submitting this testing file.


What to submit

You should ensure that your definitions for the Money class (Money.h, Money.cpp, MoneyDriver.cpp) are in a directory named Homework1. Zip up your Homework1 directory to make a file called Homework1.zip. You should submit the file Homework1.zip using the electronic submission command discussed in Homework 0.


Due Date

The files that need to be submitted are due to be turned in by 11:59:59pm on Monday, September 15th.


Grading Guide

The grading guide for this homework is posted here.

CSE 250 - Fall 2008 - Footer

Page maintained by Adrienne Decker

Contact: adrienne@cse.buffalo.edu | 130 Bell Hall | (716)645-3180 x 161