OOLogic3e_Solutions_ch02.doc - Object-Oriented Programming...

This preview shows page 1 - 3 out of 12 pages.

Object-Oriented Programming Logic and Design, 4e Solutions 2-1 An Object-Oriented Approach to Programming Logic and Design, 4rd Edition Chapter 2 Exercises From the 3 rd Edition 1. Using this book’s conventions, identify each of the following as a class, method, or variable name: a. computeSalary() b. Payroll c. hourlyWage d. hoursWorked e. YearEndTaxReport f. deductInsurance() g. insurancePremium Answer :
2. Explain why each of the following names does or does not seem like a good variable name to you.
Object-Oriented Programming Logic and Design, 4e Solutions 2-2 3. If myAge and yourRate are numeric variables, and departmentName is a string variable, which of the following statements are valid assignments? If a statement is not valid, explain why not. a. myAge = 23 b. myAge = yourRate c. myAge = departmentName d. myAge = “ departmentName e. 42 = myAge f. yourRate = 3.5 g. yourRate = myAge h. yourRate = departmentName i.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture