-
September 19th, 2013, 10:54 PM
#1
Please, need help with C++ codes..!
Write a C++ program that takes as inputs: an employee name, the hourly rate, and the number of
hours s/he worked in the last week. The program then outputs all entered information in addition
to the salary of the employee for the last week. The steps are as follows:
(1) Write C++ statements that include the header files iostream and string.
(2) Write C++ statements that declare the following variables: name of type string,
hourlyRate of type double, hoursWorked of type int, and salary of type double.
Write a C++ statement that computes the salary of the employee and stores the result in
the variable salary.
(3) Write a C++ statement(s) that output(s) the value of name, hourlyRate, hoursWorked,
and salary with the appropriate text. For example, if the values of name, hourlyRate,
hoursWorked are “Nancy”, 10.5 and 20, respectively, the outputs should be similar to
below:
Hello, Nancy! The last week you worked for 20 hours. Knowing that your hourly rate is
10.5 dollars, your salary for the last week is 210 dollars.
-
September 20th, 2013, 04:19 AM
#2
Re: Please, need help with C++ codes..!
Originally Posted by Doblomace
Write a C++ program that takes as inputs: an employee name, the hourly rate, and the number of
hours s/he worked in the last week. The program then outputs all entered information in addition
to the salary of the employee for the last week. The steps are as follows:
(1) Write C++ statements that include the header files iostream and string.
(2) Write C++ statements that declare the following variables: name of type string,
hourlyRate of type double, hoursWorked of type int, and salary of type double.
Write a C++ statement that computes the salary of the employee and stores the result in
the variable salary.
(3) Write a C++ statement(s) that output(s) the value of name, hourlyRate, hoursWorked,
and salary with the appropriate text. For example, if the values of name, hourlyRate,
hoursWorked are “Nancy”, 10.5 and 20, respectively, the outputs should be similar to
below:
Hello, Nancy! The last week you worked for 20 hours. Knowing that your hourly rate is
10.5 dollars, your salary for the last week is 210 dollars.
The homework tells you exactly what you need to do, and is very simple even for a beginner.
So what work have you done? What exactly do you need help in?
Regards,
Paul McKenzie
-
September 20th, 2013, 06:44 AM
#3
Re: Please, need help with C++ codes..!
From the 3 steps provided for the assignment, what don't you understand how to do? As Paul said in post #2, this is very simple even for a beginner.
You might like to have a look at this web site
http://www.learncpp.com/
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|