Solved

Calculating

Posted on 1998-08-01
2
249 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

688 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