What should you do?

You work as the Enterprise application developer at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers in the domain run Windows Server 2003. The design of applications forms part of your responsibilities at Domain.com. Domain.com operates as the local municipal traffic authority in Miami. You have been instructed to develop an enterprise application for Domain.com. Following is a list of all the requirements that you should keep in mind when you develop the application:
1. In the event of a driver exceeding the speed limit by more than 10 and less than 20 kilometers per hour (KPH) – the corresponding fine should be $100 with an additional amount of $10 for each KPH over the limit.
2. In the event of a driver exceeding the speed limit by 20 or more KPH, the corresponding fine should be $250 with an additional $25 for each KPH over the limit.
To this end you write the following pseudo-code to address the requirements:
DECLARE speedLimit INTEGER
DECLARE speed INTEGER
DECLARE fine INTEGER

Now you need to complete the pseudo-code.

What should you do? (Choose the correct code segment.)

You work as the Enterprise application developer at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers in the domain run Windows Server 2003. The design of applications forms part of your responsibilities at Domain.com. Domain.com operates as the local municipal traffic authority in Miami. You have been instructed to develop an enterprise application for Domain.com. Following is a list of all the requirements that you should keep in mind when you develop the application:
1. In the event of a driver exceeding the speed limit by more than 10 and less than 20 kilometers per hour (KPH) – the corresponding fine should be $100 with an additional amount of $10 for each KPH over the limit.
2. In the event of a driver exceeding the speed limit by 20 or more KPH, the corresponding fine should be $250 with an additional $25 for each KPH over the limit.
To this end you write the following pseudo-code to address the requirements:
DECLARE speedLimit INTEGER
DECLARE speed INTEGER
DECLARE fine INTEGER

Now you need to complete the pseudo-code.

What should you do? (Choose the correct code segment.)

A.
IF speed > 10 THEN
fine = 100 + 10 * (speed – speed limit)
IF speed > 20 THEN
fine = 250 + 25 * (speed – speed limit)

B.
IF speed > 20 THEN
fine = 250 + 25 * (speed – speed limit)
IF speed > 10 THEN
fine = 100 + 10 * (speed – speed limit)

C.
IF speed- speed limit> 20 THEN
fine = 250 + 25 * (speed – speed limit)
ELSE IF speed – speed limit > 10 THEN
fine = 100 + 10 * (speed – speed limit)

D.
IF speed > 10 THEN
fine = 100 + 10 * (speed – speed limit)
ELSE IF speed > 20 THEN
fine = 250 + 25 * (speed – speed limit)

Explanation:
You should make use of
IF speed – speed limit> 20 THEN
fine = 250 + 25 * (speed – speed limit)
ELSE IF speed – speed limit > 10 THEN
fine = 100 + 10 * (speed – speed limit)
as the code segment. As this is written the code first determines whether the speed exceeds the speed limit by 20 or more KPH. If so, then the fine will be set at $250 + $25 times the number of KPH exceeding the limit.
If not, the code will determine whether the speed exceeds the limit by more than 10 KPH, if so the fine is set to $100 + $10 time the number of KPH exceeding the limit.
Incorrect answer:
A: If you make use of
IF speed > 10 THEN
fine = 100 + 10 * (speed – speed limit)
IF speed > 20 THEN
fine = 250 + 25 * (speed – speed limit)
it will determine whether the speed is greater than 10KPH or whether it is 20 KPH or more instead of calculating the difference between the speed and the speed limit.
B: If you make use of
IF speed > 20 THEN
fine = 250 + 25 * (speed – speed limit)
IF speed > 10 THEN
fine = 100 + 10 * (speed – speed limit)
it will a fine to be set to $100 + $10 for each KPH over the limit even if the driver’s speed exceeds 20 KPH or more.
D: If you make use of
IF speed > 10 THEN
fine = 100 + 10 * (speed – speed limit)
ELSE IF speed > 20 THEN
fine = 250 + 25 * (speed – speed limit)
it will determine whether the speed is greater than 10 KPH or whether 20 KPH or more, instead of calculating the difference between the speed and the speed limit.



Leave a Reply 0

Your email address will not be published. Required fields are marked *