Solved

Calculating

Posted on 1998-08-01
2
247 Views
Last Modified: 2010-04-02
I have been given a Name, Lastname, hour worked, Pay rate, and Total Pay for the static text. and when I hit the Calculate the total pay button, I should be able to calculate the certain amount of money in the Total pay edit box.
For example,
First Name: Mr. A
Last Name: BBB
Hours Worked: 10
Pay rate: 4.45
Total Pay: .....

and when I hit the Calculate button, I should be able to get the amount that Mr. A receive.

Thanks
0
Comment
Question by:Nung
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
erajoj earned 200 total points
ID: 1169202
Are you using Visual C++ and MFC?
In that case; this is NOT hard!
Do you just have the payment data in the three static controls?
In that case:

1. Open your dialog and assign new names to the static controls. These are now called "IDC_STATIC" . Rename them to "IDC_HOURS" and  "IDC_PAYRATE" for instance. Also rename the edit box to "IDC_TOTALPAY".
2. Assign member variables to "IDC_HOURS",  "IDC_PAYRATE" and "IDC_TOTALPAY" using the classwizard. Use "add variable..." set names to m_sHours (IDC_HOURS), m_sPayrate (IDC_PAYRATE) and m_sTotalPay(IDC_TOTALPAY). Make sure category is "Value" and variable type is "CString".
3. Use the classwizard to connect the button to your code like this: Select your button in the "Object IDs"-list on the "Message Maps"-tab. Doubleclick the massage "BN_CLICKED". Set member function name to "OnCalcTotal". Press ok and then "Edit Code". Then enter:
    UpdateData(TRUE); // get data from controls
    m_sTotalPay.Format("%.2f", atof(m_sPayrate)*atof(m_sHours)); // calc&make string
    UpdateData(FALSE); // send data to controls

Build and run...
DONE!

/// John
0
 

Author Comment

by:Nung
ID: 1169203
thanks a lot ...maybe I may have some other question to border you again....but for this time..I appreciate it...thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question