Project 1: Building Rome in a Day

Objective

 

Make sure that students understand the basics of C/C++ from ITFN1303 such as function calls, parameter passing, conditionals, iteration, cin/cout streams, the preprocessor, and the Microsoft Visual C++ IDE.

 

This program should be relatively easy for you if you know the prerequisite information from Intro to C/C++.  If this project is difficult for you, make sure you’re up to speed on the ITFN1303 topics.

Estimated Time to Completion: < 2 hours

Task

 

Write a program in Microsoft Visual C++ that prompts the user for a non-negative integer over and over, each time printing out the Roman numeral equivalent, until the user enters the value zero (0). 

 

Some important Roman numerals you might be interested in (see the pattern?):

1          I

2          II

3          III

            4          IV

5                     V

9                     IX

10                 X

40         XL

49                 XLIX

50                 L

90                 XC

99                 XCIX

100              C

400              CD

500              D

999              CMXCIX

1000          M

3999     MMMCMXCIX

You must do the following:

 

 

50%      Write the main algorithm that loops, asking the user for an integer between 0 and 3999 until the user enters zero (0).  You must do range checking, so that if the user enters an invalid number (a negative or >= 4000), an error message is printed (but the loop continues).

 

75%      Write a function that takes in an integer (1-3999) via a by-value parameter and prints out the Roman numeral equivalent.  Return 0 upon successful completion of the function.

 

100%    Call the function you wrote for part 2 (above) from the main algorithm for each valid integer (1-3999) entered by the user.

Deliverable

 

CPP file which compiles and works as defined above.

 

Any file that doesn’t compile or terminates “ugly” will receive no credit.

 

 

Project 2: “If I Could Buy the World a Coke…”

Objective

 

Define a class with public and private sections, constructor and destructor, and accessors and modifiers.

Estimated Time to Completion: < 5 hours

Task

 

Write a program in Microsoft Visual C++ that simulates a Coke vending machine.  You must do the following:

 

 

25%      Write the interface (header file) for a Coke Vending Machine class which has the following characteristics:

 

·         Six different types of soda (a count of how many cans are available for each type)

·         An attribute cash which is a float that contains the amount of money in the vending machine

·         A constant MAX_CANS which defines the maximum number of cans for each type of soda (assume that all types of soda have the same maximum)

·         A method DisplayTypes which prints up all the types of soda currently available (all types which have at least one can available)

·         A method Vend that takes in a type of soda via a by-value parameter.  After making sure that there is an available can of this type (print an error if there is not an available can), this method must decrement the amount of that type of soda by one, add $0.75 to the cash attribute, and print “Enjoy your XXX” where XXX is the type of soda vended.

·         A method Stock that takes in a type of soda via a by-value parameter and sets the number of the specified type of soda to the maximum.  This method should print “XXX all stocked!” where XXX is the type of soda to be stocked.

·         A method WithdrawCash which decrements the cash attribute to zero (0) and prints “N emptied from machine” where N is the amount of cash in the machine before it was emptied.

·         A constructor that initializes the machine to be full of each type of soda and have no money.  The constructor should print “I’m alive” when it is finished.

·         A destructor that empties all of the sodas from the machine, sets the cash attribute to zero (0), and prints “Going offline now” when it is finished.

 

75%      Write an implementation file for all of the above-listed characteristics.

 

100%    Write a main algorithm driver file which presents the user with a menu of options (show available sodas, vend, stock, withdraw, or quit) and reads in and processes the user’s selection until the user selects quit.

Deliverable

 

Three files: a CPP file containing the class implementation, an H header file containing the class’ interface, and a CPP file which contains the driver (main).

 

Any submission that doesn’t compile or terminates “ugly” will receive no credit.

 

 

Project 3: “Money, Money Everywhere…”

Objective

 

To explore inheritance and polymorphism

Estimated Time to Completion:  10 hours

Task

Write a class hierarchy that simulates a banking system.

 

Write a class called BankAccount that has the following attributes and methods

 

Write a class called MoneyMarketAccount that inherits from BankAccount and has the following attributes and methods

 

Write a main algorithm that does the following

 

Things to consider

Deliverable

 

One file: a CPP file containing the class headers, implementations, and a driver main.

 

Any submission that doesn’t compile or terminates “ugly” will receive no credit.

 

Project 4: “Let the Games Begin”

Objective

 

To explore the Standard Template Library

Estimated Time to Completion:  15 hours

Task

Write a class that simulates a deck of cards.

 

Write a class called Card that has the following attributes and methods

 

Write a class called Deck that has the following attributes and methods

 

Note – you may use any Vector STL function or algorithm as you see fit.

 

Write a main algorithm that does the following

 

Things to consider

Deliverable

 

One file: a CPP file containing the class headers, implementations, and a driver main.

 

Any submission that doesn’t compile or terminates “ugly” will receive no credit.

 

 

Project 5: C#

Objective

 

To explore C# programming and visual controls

Estimated Time to Completion:  15-25 hours

Task

Create a visual interface and implement the program to play Blackjack in C#.  Details below:

Things to consider:

Deliverable

 

You will demo your finished project in class on 7/24.