C++/CLI Homework Projects
Homework Assignment Details
HW Project # 1
 (15 pts)

Create a new CLR console project and name it CS121HW1.

1. Add a welcome message that displays when they run the app.

2. Get users input for 3 items: Their name, age, and phone number.

3. Now, display each piece of data they entered on screen. The output should look like this:

Your name is (concatenate name here).

You claim you are (their age) years old.

Your current phone number is (their tele#).


4. Show a prompt to press any key to exit.

HW Project # 2

Working With Loops & File IO

Create a new C++ GUI project and name it CS121HW2.

1. Create a text file named "TomsInventory" in your solution and add 10 items (no prices unless you want to show off!).

Add a listbox, three buttons, and three textboxes to your form.

3. Name the textboxes to txtFName, txtLName, & txtItemPurchased. Add labels next to each textbox to show the user what to do. Name the listbox "lbProducts".

4. Now, change the names of the buttons to btnOK, btnClear, and btnQuit and change their text properties to OK, Clear, and Quit.

5. Create code to read each item in the disk file and add each item to the listbox when your app starts up.

4. Write code in the SelectedIndex_Changed event of the listbox. When they choose an item, display that item in the txtItemPurchased textbox.

5. Create an event handler for the OK button. When they click it, create a messagebox that says, "Thanks for shopping (FirstName LastName). You purchased a (Name of item)".

6. Write code to clear the form and put the blinking cursor to the FName textbox.

7. Write code for the exit button to quit the app.

HW Project # 3

Form Validation
Make a new project and add textboxes with labels for First Name, Last Name, Address, City, State, and Zip.

1. Name your controls appropriately. Change the text property of the form to something nice and center the form when the program starts.

2. Add a Checkout button. When they click it, validate each textbox using If statements to be sure all of the have data in them.

3. If any data if missing, show a messagebox to warn them about missing info. If all the data is filled in then use a messagebox to thank them for shopping.

4. Use a clear button and exit button to clean up.
HW Project # 4

Working With Custom Classes
Create a new project and add three textboxes and labels. The textboxes will accept numbers. You decide what type. Add the usual three buttons for Add, Clear, and Exit.

1. Add a new class to your project. Make sure it is managed and inline. Name it MyCalculator.

2. Now create a custom method within the class to add two numbers. Call it DoSum and make it public.
Change its signature by adding two parameters for the data types you want to add. Make sure to return the correct value. Code it so that it will add the two arguments passed into it and return the sum.

3. Now, code your form's Add button. Grab the numbers they entered and validate them before sending them to the DoSum function.

4. Ask them if they really want to exit.

5. Now, add a custom function to your form called NotifyUser and have it accept one argument, a string. When you need to send a message to the user call this function and pass in an appropriate message.
HW Project # 5

Working With Overloaded Methods
Open up project 6. Find your NotifyUser function.

1. Make another NotifyUser function but this time, have it take two arguments, a string for the message, and a string for the caption of the messsagebox.

2. Code the new function to create a messagebox that will display and message and a caption.

3. Now, go into your form code and call this second overloaded method with a message and a caption.
HW Project # 6

Working With Overloaded Constructors
Create a new project. Add three radiobuttons, OK button and Exit button.

1. Change the text for the first radio button to say "Default Message", the second will say "Message only". The third radiobutton says "Message  and Caption".

2. Add a new class. Call it DisplayMsg.

3. In the default constructor, tell it to display a messagebox with a msg that says "You are using the default constructor".

4. Create an overloaded constructor that takes one argument: a string. Code it to create a messagebox but display the msg that is passed into it.

5. Finally, create another overloaded constructor that takes two arguments: two strings. Code it so it will display a messagebox using the msg and caption that is passed into it.

Updated 2/5/2018