Programming in C++ Weekly Wages, in General If hours are more than 40.0 then wages=(400* payRate)+(hours.0)*1.5 pay Rate RECALL EXAMPLE (40X$2475)+(12X1.5X$24.75)=$143550 otherwise, wages= hours x payRate
11 If hours are more than 40.0, then wages = (40.0 * payRate) + (hours - 40.0) * 1.5 *payRate otherwise, wages = hours * payRate Weekly Wages, in General RECALL EXAMPLE ( 40 x $ 24.75 ) + ( 12 x 1.5 x $ 24.75 ) = $1435.50
Programming in C++ An Algorithm is a step-by-step procedure for solving a problem in a finite amount of time 12
12 An Algorithm is . . . ❖a step-by-step procedure for solving a problem in a finite amount of time
Programming in C++ Algorithm to Determine an Employee's Weekly Wages 1. Get the employee's hourly pay Rate 2. Get the hours worked this week 3. Calculate this week's reqular wages 4. Calculate this week's overtime wages (if any) 5. Add the regular wages to overtime wages(if any) to determine total wages for the week 13
13 Algorithm to Determine an Employee’s Weekly Wages 1. Get the employee’s hourly payRate 2. Get the hours worked this week 3. Calculate this week’s regular wages 4. Calculate this week’s overtime wages (if any) 5. Add the regular wages to overtime wages (if any) to determine total wages for the week
Programming in C++ What is a Programming Language? oolt is a language with strict grammar rules, symbols, and special words used to construct a computer program 14
14 What is a Programming Language? ❖It is a language with strict grammar rules, symbols, and special words used to construct a computer program
Programming in C++ The Second Step Implementation Phase Program o translating your algorithm into a programming language is called CODING o with C++, you use Documentation -your written comments Compiler --translates your program into machine language Main Program - may call subalgorithms 15
15 Implementation Phase: Program ❖translating your algorithm into a programming language is called CODING ❖with C++, you use Documentation -- your written comments Compiler -- translates your program into machine language Main Program -- may call subalgorithms The Second Step