Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem: A company wants a program that will calculate the weekly paycheck for an employee based on how many hours they worked. For this company,

Problem: A company wants a program that will calculate the weekly paycheck for an employee based on how many hours they worked. For this company, an employee earns $20 an hour for the first 40 hours that they work. The employee earns overtime, $30 an hour, for each hour they work above 40 hours.

Example: If an employee works 60 hours in a week, they would earn $20/hr for the first 40 hours. Then they would earn $30/hr for the 20 hours they worked overtime. Therefore, they earned: ($20/hr * 40hrs) + ($30/hr * 20 hrs) = $800 + $600 = $1400 total.

Create a pseudocode and a flowchart to design a program that will calculate an employee's weekly paycheck.

  • Write pseudocode to design a programming solution by outlining a series of steps and using appropriate indentation and keywords. Be sure to consider the following:
  • What input does the computer need?
  • What steps does the program need to follow to process the input? What output should result?
  • When might you need to use decision branching? If you used decision branching, did you account for all possible input values?
  • Did you use appropriate indentation and keywords (such as IF, ELSE, CALCULATE, and so on) throughout your pseudocode?
  • What would a flowchart designed to give the programming solution by organizing a series of steps and using appropriate symbols and arrows look like? The flowchart should use appropriate arrows and symbols for each of the following:
  • Start and end points
  • Input and output
  • Decision branching
  • Processing steps

Here is what I came up with for pseudocode:

INPUT number_of_hours;

DECLARE weekly_pay, overtime_hours, overtime_pay;

IF number_of_hours<=40:

weekly_pay=number_of_hours*20

ELSE:

overtime_hours=number_of_hours-40;

overtime_pay=overtime_hours*30;

weekly_pay=(40*20)+overtime_pay;

Does this answer seem right for the Pseudocode? Also, any help with understanding the flowchart would be great I'm at a loss. We've been using Python for coding.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions