Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8596493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:41:35+00:00 2026-06-12T00:41:35+00:00

#include <iostream> Using namespace std; int main (); { cout << What is the

  • 0
#include <iostream>
Using namespace std;

int main ();
{ 
cout << "What is the mean amount you work/week?" << endl;

if (input <= 40)
cout << "Your salary is $8.00/hour";
cin >> a1;
if (a1 <= 0)
cout << "";
cin >> a2;
if (a2 >= 40)
cout << a3
cin >> a3;

cout << "" << endl;
else
cout << " Better luck next time.- the correct answer is " << add << endl;

return 0;

I’m trying to write a C++ program to compute and display a person’s salary as determined by the following expressions:

If hours worked <= 40, the person receives $8/hour otherwise,
Person receives the first 40hrs @ $8/hr remaining hrs at 1.5x basic rate.
Program should request:
1) hours worked (input)
2) display the salary earned (output).
Use a constant variable for basic rate so the program can be updated easily when hourly rates change.
Give appropriately input/output.
Test program several x with hrs below, =, and above 40.

Any direction will be greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:41:36+00:00Added an answer on June 12, 2026 at 12:41 am

    Get some good books on C++, Check out The Definitive C++ Book Guide and List

    As per your code. This is what it should be

    #include <iostream>
    
    int main () {
        int hours = 0;
        int rate = 8;
    
        std::cout << "Enter number of working hours?";
        std::cin >> hours;
    
        int pay = hours * rate;
    
        if (40 < hours) {
            pay += (hours - 40) * (rate / 2);
        }
    
        std::cout << "Total Pay" << pay << std::endl;
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include <iostream> using namespace std; int main() { cout << !!!Hello World!!! << endl;
#include <iostream> using namespace std; int main() { int a, b, c, max; cout<<a=;
This doesn't work. Can anyone tell why? #include <iostream> using namespace std; int mean(
#include <iostream> using namespace std; int main (int argc, char* const argv[]) { int
#include <iostream> using namespace std; int main(void){ int size = -2; int* p =
Example: #include <iostream> using namespace std; int main() { wchar_t en[] = LHello; wchar_t
The following code #include <iostream> using namespace std; int main() { const char* const
Short problem: #include <iostream> using namespace std; int main() { double **T; long int
#include <iostream> #include <string.h> using namespace std; int main() { int e=0; int b=0;
#include <iostream> #include <iomanip> using namespace std; int main() { char array[10]; for(int i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.