Midterm Solutions (Version 3) Fall 2014

First-page document preview for Midterm Solutions (Version 3) Fall 2014 in COE 318: Software Systems at Toronto Metropolitan University (TMU). Inspect the first page below or request the complete PDF study document for free.

Independent study archive Learn more

Materials are uploaded by users for self-study purposes. PwnHero is an independent platform, not affiliated with, sponsored by, or endorsed by any university or institution.

📄 Page 1 Preview
First page preview of Midterm Solutions (Version 3) Fall 2014 for Software Systems at Toronto Metropolitan University (TMU)

Page 1 Key Topics & Excerpt

🔍 Text Transcript

First page excerpt for quick study reference. Complete formulas, diagrams, and subsequent pages are available in the full document.

PwnHero 1 Ryerson University Department of Electrical & Computer Engineering COE318 Midterm Oct. 15, 2014 Name:________________________ Student number:________ Time: 60 minutes Circle the name of your Professor: E. Bagheri, K. Clowes, O. Das This is a closed-book exam. If in doubt on any question, then you must clearly state your own assumption(s). _____________________________________________________________ Question 1. (5 marks) Here is an incomplete declaration for the Employee class. a) Write the code for the constructor of the Employee class. b) Write the code for the toString method of the Employee class. public class Employee { String name; int id; // Constructor // Initializes the instance variables name and id with the // specified arguments public Employee(String n, int i) { // (a) Write the constructor code here } // Returns a string containing the name and id of this Employee // object. The name and id should be separated by a comma. // For example, for an Employee whose name is “James” and id // 123, this method should return the string “James, 123” public String toString() { // (b) Write the toString method code here } } PwnHero.com

Related COE Courses at Toronto Metropolitan University (TMU)