Question

Create a flowchart and a C++ program for the following problems: 1. Annual Salary: Workers at...

Create a flowchart and a C++ program for the following problems:

1. Annual Salary: Workers at a particular company have won a 7.6% pay increase retroactive for six months.
Write a flowchart and C++ program that takes an employee’s previous annual salary as
input and outputs the amount of retroactive pay due the employee, the new annual salary,
and the new monthly salary. Use a variable declaration with the modifier const to express
the pay increase.

2. Extract the Digits: Create a flowchart and C++ program that would input a 5-digit number and then extract its
one’s digit , ten’s digit, hundred’s digit, thousand’s digit and ten thousand’s digit. Output the
extracted digits and output the digits in reverse order (you must use a formula in reversing
the order of the 5- digit number).
Example: Enter a 5-digit number: 23654
Output should be the following:
Ten Thousand’s Digit is 2
Thousand’s Digit is 3
Hundred’s Digit is 6
Ten’s Digit is 5
One’s Digit is 4
The reverse order is 45632

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer 1:

Flowchart:

Code:

#include <iostream>

using namespace std;

int main() {
    const double payIncrease = 7.6 / 100;
    double annualSalary, retroactivePay, newAnnualSalary, newMonthlySalary;
    cout << "Enter previous annual salary: $";
    cin >> annualSalary;
    retroactivePay = annualSalary * payIncrease * 6 / 12;
    newMonthlySalary = annualSalary / 12 + retroactivePay / 6;
    newAnnualSalary = newMonthlySalary * 12;
    cout << "Retroactive pay: $" << retroactivePay << endl;
    cout << "New monthly salary: $" << newMonthlySalary << endl;
    cout << "New annual salary : $" << newAnnualSalary << endl;
    return 0;
}

Output:

Answer 2:

Flowchart:

Code:

#include <iostream>

using namespace std;

int main() {
    int num, nTenThousands, nThousands, nHundreds, nTens, nOnes, numReverse;

    cout << "Enter a 5-digit number: ";
    cin >> num;

    nOnes = num % 10;
    nTens = (num / 10) % 10;
    nHundreds = (num / 100) % 10;
    nThousands = (num / 1000) % 10;
    nTenThousands = num / 10000;
    numReverse = nOnes * 10000 + nTens * 1000 + nHundreds * 100 + nThousands * 10 + nTenThousands;

    cout << "Ten Thousand's Digit is " << nTenThousands << endl;
    cout << "Thousand's Digit is " << nThousands << endl;
    cout << "Hundred's Digit is " << nHundreds << endl;
    cout << "Ten's Digit is " << nTens << endl;
    cout << "One's Digit is " << nOnes << endl;
    cout << "The reverse order is " << numReverse << endl;
    return 0;
}

Output:

Add a comment
Know the answer?
Add Answer to:
Create a flowchart and a C++ program for the following problems: 1. Annual Salary: Workers at...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Program : Write a complete C++ program that Input: Read a positive integer from the keyboard...

    Program : Write a complete C++ program that Input: Read a positive integer from the keyboard (user) with proper prompt text and save it to a variable. The integer have up to five digits. Processing: From the right most digit, extract every digit from the input integer using modular operator %then save the digit to a separate variable. Remove the right most digit from the integer using integer division operator /. Repeat above two steps till all digits have been...

  • Create Code Using C program: 1. Write a function, reverse Digit, that takes an integer as...

    Create Code Using C program: 1. Write a function, reverse Digit, that takes an integer as a parameter and returns the number with its digits reversed. For example, the value of reverseDigit (12345) is 54321; the value of reverse Digit (5600) is 65, the value of reverse Digit (7008) is 8007 and the value of reverse Digit (-532) is -235.

  • Use Microsoft Word to create a flowchart for the following instructions Note: Within your flowchart you...

    Use Microsoft Word to create a flowchart for the following instructions Note: Within your flowchart you will need to use terminators, process boxes, input/outputs and a decision diamond 1. Asks the employee to input the number of hours worked that week. 2. If the employee inputs a decimal number output "Sorry, must be a whole number and return to the original input asking for number of hours to be input 3. If they worked more than 8 hours - multiply...

  • Write a C program which calculates how many digits a number has and prints each digit...

    Write a C program which calculates how many digits a number has and prints each digit in reserve order with space in between(no space after the last digit). The number > 0 and has no more than 5 digits. (optional] It is better to write two functions. One is designed for printing number in reverse order and the other is for counting the number of digits. Given that the value of number (which is an int variable) is 12345, the...

  • Help on coding this in c++. I am confused as how to go about this problems!...

    Help on coding this in c++. I am confused as how to go about this problems! IZzes 1. (Metric - English units Conversion) nferences A metric ton is 35,273.92 ounces. Write a C++ program to read the weight of a box of cereal in ounces then output this weight in metric tons, along with the number of boxes to yield a metric ton of cereal. llaborations at Design: To convert 14 ounces (of cereal) to metric tons, we use the...

  • Write a C++ console application that uses functions to calculate an employee’s salary.

    Write a C++ console application that uses functions to calculate an employee’s salary.PART 1: Create a void function to print a menu asking the user to choose from the following options:1 - Annual salary2 - Monthly salary3 - Daily rate of pay4 – ExitThe void function only prints the menu. Format your cout statement to include the menu as displayed above.If the chosen option is 1- Annual Salary, ask the user for the number of hours they work perweek and...

  • Flowchart for Python program: Design and create a program for the ULM Coffee Shop to provide...

    Flowchart for Python program: Design and create a program for the ULM Coffee Shop to provide some customer market research data. When a customer places an order, a clerk asks for the customer’s zip code and age. The clerk enters that data as well as the number of items the customer orders. The program operates continuously until the clerk enters a 0 for zip code at the end of the day. When the clerk enters an invalid zip code (more...

  • The program calculates a tax rate and tax to pay given an annual salary. The program...

    The program calculates a tax rate and tax to pay given an annual salary. The program uses a class, TaxTableTools, which has the tax table built in. Run the program with annual salaries of 10000, 50000, 50001, 100001 and -1 (to end the program) and note the output tax rate and tax to pay. The output should be as follows: Enter annual salary (-1 to exit): 10000 Annual Salary: 10000 Tax rate: 0.1 Tax to pay: 1000 Enter annual salary...

  • Questions:(to be answered within the video) Write a C++ program with the following specifications: 1. Create...

    Questions:(to be answered within the video) Write a C++ program with the following specifications: 1. Create a class and name it Payslip. This class should have the following attributes or properties: name,pay grade, basic salary, overtime hours, overtime pay, gross pay, net pay and withholding tax. 2. Define the accessors and mutators of the Payslip class based on its attributes or properties.  This class should also have the following methods: determinePayGradeAndTaxRate and computePay. 3. Create another class and name it Employee.  This...

  • Using the above described algorithm, create a program that: (IN PYTHON) 1.Asks the user which type...

    Using the above described algorithm, create a program that: (IN PYTHON) 1.Asks the user which type of credit card he/she would like to find the checksum for. 2. Based on the user's choice of credit card, asks the user for the n digits of the credit card. [Get the input as a string; it's easier to work with the string, so don't convert to an integer.] 3. Using the user's input of the n digits, finds the last digit of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT