Once this form has been customized for your institution, you can use this button to send your lab work. Be sure to read the instructions
before starting your work.
To gain experience with
If the computer which you are using for this lab is managed by your school, you probably already have the wxWindows
toolkit installed and configured to compile wxWindows programs using your C++ compiler. However, if you are using
your own computer, you will need to download wxWindows from www.wxwidgets.org.
The companion website for the text, www.wiley.com/college/horstmann,
contains detailed instructions on how to compile wxWindows programs on your platform.
You will develop a GUI program in this lab which will ask the user to input the amount of a deposit to a cd,
the number of years or term of the CD and the interest rate. Your program will then print out the value of the
deposit at the end of the term. To begin , write the code to create a frame.
/*insert your code here
Now, add a text control to the frame.
The user interface for the CD Calculator application should look similar to the following:
Notice that there are four textboxes, two buttons and several labels. We have already designed the frame and
a text control.
The top line can be displayed as a single wxStaticText object. The labels and text controls should be displayed
using a wxFlexGridSizer to create two columns.
Modify your code from P1 to display the top line (Certificate of Deposit Calculator) as well as all of the labels
and text controls.
Next, add the two buttons. These are added by creating new objects of the wxButton class.
We need to define actions for each button using an event table. The onClearForm event should simply clear out
all of the text controls. The onCalculate event should do the following:
calculate the final value using the following formula:
final value = deposit * ((1+(interest_rate/12))^(numberOfYears*12)
display the final value in the appropriate text control
Add the event table to your code as well as the appropriate methods to the buttonframe.
Use the following test data to determine if your application is working properly:
Don't forget to send your
answers when you're finished.