Question: LAB 4 CS 200 PASS BY VALUE FUNCTIONS Num Description 1 Reversing Digits - Complete the template program reverseNumber.cpp 2 Write a function that has

LAB 4 CS 200

PASS BY VALUE FUNCTIONS

Num Description

1 Reversing Digits - Complete the template program reverseNumber.cpp

2 Write a function that has an double as a parameter and returns a double through the function call. The parameter is the income for a single person and the return value is the amount of income tax owed.

Use the Schedule X Single table below.

Write a main function to test the function you have written.

You are required to used

nested if else if else if else

to determine the calculation to use for the tax.

Schedule X Single

If taxable income is over--

But not over--

The tax is:

$0

$7,550

10% of the amount over $0

$7,550

$30,650

$755 plus 15% of the amount over 7,550

$30,650

$74,200

$4,220.00 plus 25% of the amount over 30,650

$74,200

$154,800

$15,107.50 plus 28% of the amount over 74,200

$154,800

$336,550

$37,675.50 plus 33% of the amount over 154,800

$336,550

no limit

$97,653.00 plus 35% of the amount over 336,550

3 Modify the 13 eggs problem from Lab 3.

Write a function that makes the selection for the Tortoise.

The prototype for the function is: int tortoisePick(int numberEggs, int harePicked)

There is a strategy that you can use so that the Tortoise always wins.

When the function is called, if numberEggs is equal to 13,

the tortoise is making the first selection. If

numberEggs is not equal to 13 , the hare has

made a selection and the hares selection was passed

as the second parameter, harePicked.

The return value is the number of eggs that the Tortoise selects.

Hint: After the hare picks, if the tortoise makes a selection so that the sum of

both picks is 4, then the tortoise will always be the winner, since 12 is evenly

divisible by 4.

4 Write a function that has an integer as a parameter.

The function will return a string that represents the day of the week. If the parameter is a 1, the function will return the string Monday.

If the parameter is not between 1 and 7 the function should return "ERROR"

Write a driver program to test your function.

You are required to use a switch statement in your function. Use the default case to catch error conditions.

NOTE: for string variables use:

#include using namespace::std; int main() {

string day; // day is a string variable

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!