Question

Instructions Answer all four questions in Part I 50 Points for Question 1. Briefly describe the difference between a binary b
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Binary Routine:

Binary branching is a two way decision statement , when we need to take a decision based on condition is true of false.

If condition is true , control takes branch1 or

if condition is false , control takes branch 2.

In Multiway branching, there is a possibility of multiple conditions that is more than two , if a particular condition is true, that particular block is taken.

----------------------------------------------
//Routine for computing pay using binary choice
void binarybranch(double final_rate, double hours){
double pay,pay1,pay2;
  
if(hours<=40)
pay=hours*rate;

else
{
overtime=hours-40;
pay1=40*final_rate;
pay2=overtime*2*final_rate;
pay=pay1+pay2;
}
cout<<"Total pay:"<<pay<<endl;
}

-----------------------------------------------


//Routine for computing pay using multiple branching choice
void multi_way_branch(double final_rate, double hours)

{
double pay,pay1,pay2;
  
if(hours<=40)//branch1
pay=hours*rate;

else if(hours>40 &&hours<50)//branch 2
{
overtime=hours-40;
pay1=40*final_rate;
pay2=overtime*2*final_rate;
pay=pay1+pay2;
}
else if(hours>=50&&hours<60)//branch3
{

overtime=hours-40;
pay1=40*final_rate;
pay2=overtime*3*final_rate;
pay=pay1+pay2;
}
else //branch 4
{
overtime=hours-40;
pay1=40*final_rate;
pay2=overtime*3*final_rate;
pay=pay1+pay2;
}

cout<<"Total pay:"<<pay<<endl;
}

Add a comment
Know the answer?
Add Answer to:
Instructions Answer all four questions in Part I 50 Points for Question 1. Briefly describe the...
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
  • please show work!!!! Part 2, Instructions: Read the information below and use this to answer question 9-11 on pa...

    please show work!!!! Part 2, Instructions: Read the information below and use this to answer question 9-11 on page 8 Section 9. OVERTIME Pursuant to the provisions of the Fair Labor Standards Act, non-exempt employees shall be paid overtime at their appropriate rate of not less than one and one-half(1 %) times their rate of pay for each hour worked in a work period in excess of the maximum hours allowable, which are applicable to the type of employment in...

  • Any help appreciated! Question 1 (5 points). Answer each of the following questions briefly. The questions...

    Any help appreciated! Question 1 (5 points). Answer each of the following questions briefly. The questions are based on the following relational schema: Emp( eid: integer, ename: string, age: integer, sala1l1: real) Works( eid: integer, did: integer, pet_time: integer) Dept(did: integer, dname: string, budget: real, managerid: integer) 1. Give an example of a foreign key constraint that involves the Dept relation. 2. Write the SQL statements required to create the preceding relations, including appropriate versions of all primary and foreign...

  • Activity #3 Part 1 Required: Analyze the transactions and prepare the journal entries 1. The company...

    Activity #3 Part 1 Required: Analyze the transactions and prepare the journal entries 1. The company borrowed $8,500 on February 1. It is a 9-month note with a 6% interest rate. The company prepares financial statements on a quarterly basis. Prepare the necessary adjusting entry, 2. Employees are paid every other Monday for the previous 2 week pay period. January 31 is on a Saturday. The last pay day was Monday, January 26 for the 2- week period of January...

  • Use program control statements in the following exercises: Question 1 . Write pseudocode for the following:...

    Use program control statements in the following exercises: Question 1 . Write pseudocode for the following: • Input a time in seconds. • Convert this time to hours, minutes, and seconds and print the result as shown in the following example: 2 300 seconds converts to 0 hours, 38 minutes, 20 seconds. Question 2. The voting for a company chairperson is recorded by entering the numbers 1 to 5 at the keyboard, depending on which of the five candidates secured...

  • If you’re using Visual Studio Community 2015, as requested, the instructions below should be exact but...

    If you’re using Visual Studio Community 2015, as requested, the instructions below should be exact but minor discrepancies may require you to adjust. If you are attempting this assignment using another version of Visual Studio, you can expect differences in the look, feel, and/or step-by-step instructions below and you’ll have to determine the equivalent actions or operations for your version on your own. INTRODUCTION: In this assignment, you will develop some of the logic for, and then work with, the...

  • FART I TRUE FALSE QUESTIONS (10 points). Please write True (1) or False (F) on the...

    FART I TRUE FALSE QUESTIONS (10 points). Please write True (1) or False (F) on the blank Scarcity is the intimited nature of society's resources given society's limited wants 2. A reward is a type of positive incentive. 3. To remove difficulty of double coincidence of wants we use money. 4. An exogenous factor is a variable that can be controlled for inside the model. 5. The PPF will not have a constant slope. 6. The law of demand states...

  • Please read the article and answer about questions. You and the Law Business and law are...

    Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...

  • TRUE OR FALSE/ MULTIPLE CHOICE and word response questions. C. a more permanent government involvement in the ba...

    TRUE OR FALSE/ MULTIPLE CHOICE and word response questions. C. a more permanent government involvement in the banking system, even creating a pational banking system that owns and operates most of the global and regional banks. Deshort-term increases in government spending to stimulate the economy. 20. When describing the state of the U.S. economy, reporters often refer to the nation's GDP, its unemployment rate, and the CPI. Explain what each of these terms means and why each measure is significant....

  • How can we assess whether a project is a success or a failure? This case presents...

    How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

  • Comprehensive Income Tax Course: Module 1 4. Randy turned 16 last year and had his first...

    Comprehensive Income Tax Course: Module 1 4. Randy turned 16 last year and had his first summer job. Even though his parents are claiming him as a dependent he wants to file a return in order to get his refund. He receives his W-2 and decides he can do his own return using form 1040-EZ. Which of the following information is not found on a Form W-2? a) The taxpayer’s Social Security number b) The taxpayer’s wages, tips and other...

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
ADVERTISEMENT