Question

In: Computer Science

A construction company has 3 categories of casual workers. Category A,B and C. Workers in categories...

A construction company has 3 categories of casual workers. Category A,B and C. Workers in categories A are paid 1000 per day for first 25 days, you are paid 800 per day for less than 25 days, any extra day after 25th you are paid 1200 per day. In categorie B you are paid 800 per day if you work for 25 days otherwise you are paid 600 per day if you work for less than 25 days . 1000 per day for any day after 25th.
Category C 600 per day for 25 days , 400 per day for days before 25 days and 800 per day for days after 25th day

Question
1.write an algorithm
2. Translate to flowchart
3. Translate into actual program using C++

Solutions

Expert Solution

Here is the solution to above program PLEASE GIVE A THUMBS UP IF YOU LIKE THE SOLUTION

1) Write an Algorithm

calculateMoney(category,days)
{
   money=0;
   if(category=='A')
{
if(days>=25)
{
money+=25*1000 + (days-25)*1200;
}
else
{
money=days*800;
}
}
else if(category=='B')
{
if(days>=25)
{
money+=25*800 + (days-25)*1000;
}
else
{
money=days*600;
}
}
else if(category=='C')
{
if(days>=25)
{
money+=25*600 + (days-25)*800;
}
else
{
money=days*400;
}
}

return money;
}

2) Translate to flowchart

C) C++ PROGRAM . please refer to code screenshot for indentation and help via comments

C++ CODE

#include <iostream>
using namespace std;

int main() {
    char ch;
    int days;
    int money=0;
    //taking user input for the customer
    cout<<"Enter the category of a worker (A|B|C): ";
    cin>>ch;
    cout<<"Enter the number of days he/she worked: ";
    cin>>days;
    //checking is worker from category A
    if(ch=='A')
    {
        if(days>=25)
        {
            money+=25*1000 + (days-25)*1200;
        }
        else
        {
            money=days*800;
        }
    }
    //checking if worker is from category B
    else if(ch=='B')
    {
        if(days>=25)
        {
            money+=25*800 + (days-25)*1000;
        }
        else
        {
            money=days*600;
        }
    }
    //checking if worker is from category C
    else if(ch=='C')
    {
        if(days>=25)
        {
            money+=25*600 + (days-25)*800;
        }
        else
        {
            money=days*400;
        }
    }
    //printing the money made by the worker
    cout<<"Money Paid to Worker is "<<money<<endl;
    return 0;
}

OUTPUT OF CODE

SCREENSHOT OF CODE


Related Solutions

A construction company has 3 categories of casual workers. Category A,B and C. Workers in categories...
A construction company has 3 categories of casual workers. Category A,B and C. Workers in categories A are paid 1000 per day for first 25 days, you are paid 800 per day for less than 25 days, any extra day after 25th you are paid 1200 per day. In categorie B you are paid 800 per day if you work for 25 days otherwise you are paid 600 per day if you work for less than 25 days . 1000...
A construction company has 3 categories of casual workers. Category A,B and C. Workers in categories...
A construction company has 3 categories of casual workers. Category A,B and C. Workers in categories A are paid 1000 per day for first 25 days, you are paid 800 per day for less than 25 days, any extra day after 25th you are paid 1200 per day. In categorie B you are paid 800 per day if you work for 25 days otherwise you are paid 600 per day if you work for less than 25 days . 1000...
The largest category of healthcare workers is: A. Physicians B. Respiratory Therapists C. Physician Assistants D....
The largest category of healthcare workers is: A. Physicians B. Respiratory Therapists C. Physician Assistants D. Occupational Therapists E. Nurses
A. Give 3 categories of Long-term Investments (please mention examples for each category) B. What is...
A. Give 3 categories of Long-term Investments (please mention examples for each category) B. What is the difference between Tangible Assets and Intangible Assets? Give examples please.
A municipal bond service has three rating categories​ (A, B, and​ C). Suppose that in the...
A municipal bond service has three rating categories​ (A, B, and​ C). Suppose that in the past​ year, of the municipal bonds issued thoughout a​ country, 60% were rated​ A, 30% were rated​ B, and 10% were rated C. Of the municipal bonds rated​ A, 30% were issued by​ cities, 30% by​ suburbs, and 40% by rural areas. Of the municipal bonds rated​ B, 40% were issued by​ cities, 50% by​suburbs, and 10% by rural areas. Of the municipal bonds...
A municipal bond service has three rating categories​ (A, B, and​ C). Suppose that in the...
A municipal bond service has three rating categories​ (A, B, and​ C). Suppose that in the past​ year, of the municipal bonds issued thoughout a​ country, 60 % were rated​ A, 30 % were rated​ B, and 10 % were rated C. Of the municipal bonds rated​ A, 60 % were issued by​ cities, 10 % by​ suburbs, and 30 % by rural areas. Of the municipal bonds rated​ B, 40 % were issued by​ cities, 50 % by​ suburbs,...
Please explain the 3 categories of risk preference and which category applies to the average investor.
Please explain the 3 categories of risk preference and which category applies to the average investor.
A store has 4 categories A, B, C and D, create a program that asks you...
A store has 4 categories A, B, C and D, create a program that asks you 10 times the sale and the category so that at the end it shows you the total by category, and the sum of all. Code in C # and Python
A company has 3 machines: A, B, and C. The number of breakdowns per week is...
A company has 3 machines: A, B, and C. The number of breakdowns per week is distributed Poisson. On average, machine A breaks down .4 times per week, machine B breaks down .45 times per week and machine C breaks down .9 times per week. The probability that there are 2 breakdowns in one week is _____ (round to 4 decimal places).
When one company (A) buys another company(B), some workers of company B are terminated. Terminated workers...
When one company (A) buys another company(B), some workers of company B are terminated. Terminated workers get severance pay. To be fair, company A fixes the severance payment to company B workers as equivalent to company A workers who were terminated in the last one year. A 36-year-old Mohammed, worked for company B for the last 10 years earning 32000 per year, was terminated with a severance pay of 5 weeks of salary. Bill smith complained that this is unfair...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT