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 youre up to speed on the ITFN1303 topics.
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.
CPP file which compiles and works as defined above.
Any file that doesnt compile or
terminates ugly will receive no credit.
Define a class with public and private sections, constructor and destructor, and accessors and modifiers.
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 Im 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 users selection until the user selects quit.
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 doesnt compile or terminates ugly will receive no credit.
Define a program that demonstrates knowledge of composition, dynamic allocation with new and delete, and friend functions.
Write a program in Microsoft Visual C++ that simulates a simple building. You must do the following:
25% Write the interface (header file) for an ITBuilding class which has the following characteristics:
· An private attribute DownstairsMachine which is a vending machine (from project 2)
· A constructor that prints Building operational when it is finished.
· A destructor that prints Building closing when it is finished.
· Has a friend function called HackerStudentStealsCoke
50% Write an implementation file for all of the above-listed characteristics.
100% Write a main algorithm driver file which does the following
· Creates a pointer to an ITBuilding
· Instantiates the ITBuilding using the new command
· Calls the HackerStudentStealsCoke function
· Destroys the ITBuilding using the delete command
· Write the HackerStudentStealsCoke function which simply calls the vend method of the DownstairsMachine attribute of the ITBuilding object; you can vend any type of soda youd like just hardcode it in as 0 or 1 or whatever youd like.
Note
if youd like, use the VendingMachine
class provided on the 2313 site rather than your own.
To make sure that youre on track (yeah its that simple!), this is all your program should print (or something real similar):
I'm
alive.
Building
operational.
Enjoy
your Coke!
Building
closing.
Going
offline now.
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). Please dont submit your VendingMachine class Ive already got that, and it should be the exact same as from Project 2!
Any submission that doesnt compile or terminates ugly will receive no credit.
To explore inheritance and polymorphism
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
One file: a CPP file containing the class headers, implementations, and a driver main.
Any submission that doesnt compile or terminates ugly will receive no credit.
To explore the Standard Template Library
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
One file: a CPP file containing the class headers, implementations, and a driver main.
Any submission that doesnt compile or terminates ugly will receive no credit.
To explore MFC programming
Convert your console-based Blackjack application to a GUI (Graphical User Interface) application using MFC.
NOTE - if you want, please feel free to use my implementation of the Card, Deck, and Hand classes (and look at my main algorithm for info too). Don't waste your time on this project trying to make up for mistakes in your implementation of Project 5 - the point here is to learn MFC, not redo the Vector and STL tasks.
The interface is up to you, but you must have the following:
Check out my working demo for some UI hints.
You will demo your finished project in class on 4/23.