111k views
1 vote
Given that Jamie worked 50 hours (Hours = 50) last week and earns $10.00 an hour (Rate = 10), how much did Jamie earn last week, before taxes (TotalPay)? If (Rate >=10) OR (Hours <=40) Then TotalPay = Hours * Rate Else TotalPay = (Hours * Rate)+(Hours–40)*Rate*1.5 End If

User Aaafly
by
3.6k points

1 Answer

6 votes

Answer:

Jamie earned (Total pay) $500.

Step-by-step explanation:

We are given the following code:

If (Rate >=10) OR (Hours <=40) Then

TotalPay = Hours * Rate

Else

TotalPay = (Hours * Rate)+(Hours–40)*Rate*1.5

End If

Let us understand the code line by line:

The first line contains an if statement with 2 conditions:

i.e. 1st condition:

The rate is greater than or equal to 10

2nd condition:

Number of hours are lesser than or equal to 40.

There is OR between the two condition i.e. the statement next to if() statement will get executed if any one of them becomes true and else part will not be executed.

The next statement is:

TotalPay = Hours * Rate

It calculates the pay if any of the two conditions written earlier becomes true.

Next statement is else statement:

It will get executed given that the above if() statement becomes false.

Now, we are given that Jamie worked 50 hours last week and earns $10.00 an hour:

i.e.

Hours = 50

Rate = 10

Now, let get to the code execution.

The first condition is true i.e. Rate >= 10 (because Rate is 10 here)

So, the following statement will be used to calculate the Total pay:

TotalPay = Hours * Rate

and else part will not be executed.

TotalPay = 50 * 10 = $500

Jamie earned (Total pay) $500.

User Shadoe
by
3.8k points