cse-110-homework-4-answer-k

cse-110-homework-4-answer-k - Name: Student ID # CSE 110...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Name: Student ID # CSE 110 Homework 4 — ANSWER KEY Due: Friday, December 3, at the beginning of class, on paper. This assignment is worth a total of 12 points. You must show all work in order to receive any credit for your solutions. 1. Complete the computeSalary() method below, which calculates and returns an employee's weekly pay based on the rules below. (2 points) a. The normal pay rate for an employee is $8.00 per hour. b. Employees are paid at their normal rate up to and including 40 hours. c. Hours past 40 but below 50 are paid at 150% of the normal rate. d. Hours past 50 are paid at 200% of the normal rate. double computeSalary (int hours) { if (hours <= 40) // 0.5 point for this case { return hours * 8.0; } else if (hours <= 50) // 0.5 point for this case { return 320 + (hours - 40) * 12.0; } else // 1.0 point for this case { return 320 + 120 + (hours - 50) * 16.0; } }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2. Consider the grammar S ( L ) S a L L , S L S Draw a parse tree for the sentence ( a , ( a
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

cse-110-homework-4-answer-k - Name: Student ID # CSE 110...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online