IT 140 Module Three Assignment IT 140 Module Three Assignment Guidelines and Rubric Overview: As programs become more complex, it becomes increasingly important to plan or design your code before writing it. Designing your code will help you organize its logic. It will also help you keep track of the different possibilities that your program needs to handle. Two tools that programmers use to design their code are flowcharts and pseudocode. You have learned about these tools in the module resources. In this assignment, you will complete a simple flowchart and pseudocode to design a programming solution for a specific problem. Prompt Problem: A company wants a program that will calculate the amount an employee earns. The company pays
30 an hour for each hour they work. Example: If an employee works 60 hours in a week, they earn
30/hr for the 20 hours they worked overtime. Therefore, they earned: (
30/hr * 20hrs) =
600 = $1400 total. For this assignment, you must create pseudocode and a program that will calculate an employee’s weekly paycheck. Write pseudocode to design a program. When you write your pseudocode, be sure to consider the following: – What input does the computer need? – What steps does the program need to follow? – What output should result? – Did you use appropriate indentation and keywords such as IF, ELSE, CALCULATE, and so on throughout your pseudocode? Create a flowchart to design a programming solution by organizing a series of steps and using appropriate symbols and arrows. As you create your flowchart, be sure to use appropriate arrows and symbols for each of the following: – Start and end points – Input and output – Decision branching – Processing steps
The Correct Answer and Explanation is:
✅ Pseudocode: Weekly Paycheck Calculator
pgsqlCopyEditSTART
PROMPT user to enter hoursWorked
SET hourlyRate to 30
IF hoursWorked > 40 THEN
SET overtimeHours to hoursWorked - 40
CALCULATE regularPay as 40 * hourlyRate
CALCULATE overtimePay as overtimeHours * (hourlyRate * 2)
CALCULATE totalPay as regularPay + overtimePay
ELSE
CALCULATE totalPay as hoursWorked * hourlyRate
END IF
DISPLAY "Total weekly paycheck is $" + totalPay
END
🧠 Explanation
When designing a program to calculate an employee’s weekly paycheck, using pseudocode and flowcharts helps clarify logic and program flow. This solution begins with prompting the user to input the number of hours they worked during the week. This is essential input data for the program to calculate the employee’s pay.
The program uses a fixed hourly rate of $30. The key logic lies in identifying whether the employee worked overtime. Overtime is any time worked beyond 40 hours a week. The program checks if the total hours worked is greater than 40. If this condition is true, it calculates the regular pay for 40 hours and then calculates overtime pay at a rate of double the hourly rate. It adds both to get the total pay.
If the employee worked 40 hours or fewer, the program calculates pay by multiplying hours worked by the hourly rate directly. The use of keywords like IF, ELSE, and CALCULATE makes the pseudocode easy to understand and helps represent conditional and mathematical logic.
The program ends by displaying the total paycheck, which is the expected output. Indentation clearly shows the structure, making the code easier to read and maintain.
Designing the program before coding minimizes errors and improves logic. It helps the programmer visualize steps, inputs, decisions, and expected outputs. This is especially helpful as programs become more complex, ensuring that every possible scenario is considered before actual implementation.
📊 Flowchart Instructions (Verbal Description)
- Start symbol (oval) labeled “Start”
- Input symbol (parallelogram) to get
hoursWorked
- Process symbol (rectangle) to set
hourlyRate = 30
- Decision symbol (diamond): Is
hoursWorked > 40?
- If YES:
- Calculate
overtimeHours = hoursWorked - 40
- Calculate
regularPay = 40 * hourlyRate
- Calculate
overtimePay = overtimeHours * (hourlyRate * 2)
- Calculate
totalPay = regularPay + overtimePay
- Calculate
- If NO:
- Calculate
totalPay = hoursWorked * hourlyRate
- Calculate
- If YES:
- Output symbol (parallelogram) to display
totalPay
- End symbol (oval) labeled “End”
