[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Calculating

Posted on 1998-08-01
2
Medium Priority
?
253 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 800 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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 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…

650 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