WEEK 13 EXAMPLES MONDAY SECTION 2. Author class. public class Author { private static int ID=0; private String AuthorName;

Size: px
Start display at page:

Download "WEEK 13 EXAMPLES MONDAY SECTION 2. Author class. public class Author { private static int ID=0; private String AuthorName;"

Transcription

1 WEEK 13 EXAMPLES MONDAY SECTION 2 Author class public class Author { private static int ID=0; private String AuthorName; private String DOB; public Author() { AuthorName = ""; DOB = ""; public Author(String authorname, String dob) { AuthorName = authorname; DOB = dob; public Author(Author Temp) { AuthorName = Temp.getAuthorName(); DOB = Temp.getDOB(); /* (non-javadoc) public String tostring() {

2 return "Author [getauthorname()=" + getauthorname() + ", getdob()=" + getdob() + "]"; the id public static int getid() { return ID; the authorname public String getauthorname() { return AuthorName; the dob public String getdob() { return DOB; id the id to set public static void setid(int id) { ID = id; authorname the authorname to set public void setauthorname(string authorname) { AuthorName = authorname; dob the dob to set public void setdob(string dob) {

3 DOB = dob; Publisher Class public class Publisher { private static int ID=100; private String name; private String Location; public Publisher() { this.name = ""; Location = ""; public Publisher(String name, String location) { this.name = name; Location = location; public Publisher(Publisher T ) { this.name =T.getName(); Location = T.getLocation(); /* (non-javadoc) public String tostring() { return "Publisher [getname()=" + getname() + ", getlocation()=" + getlocation() + "]";

4 the id public static int getid() { return ID; the name public String getname() { return name; the location public String getlocation() { return Location; id the id to set public static void setid(int id) { ID = id; name the name to set public void setname(string name) { this.name = name; location the location to set public void setlocation(string location) { Location = location;

5 Book Class public class Book { private static int ID =0; private String Title; private Author [ ] BookAuthors; private Publisher BookPublisher; private int Edition; private int YearPublished; public Book() { Title = ""; BookAuthors = null; BookPublisher = null; Edition = 0; YearPublished = 0000; public Book(String title, Author[] newbookauthorsarray, Publisher newbookpublisher, int edition, int yearpublished) { Title = title; BookAuthors = new Author [ newbookauthorsarray.length ]; for (int index=0; index <BookAuthors.length; index++) { BookAuthors[index] = new Author (newbookauthorsarray[index]); BookPublisher = new Publisher (newbookpublisher); Edition = edition;

6 YearPublished = yearpublished; public Book(Book AnyBook) { Title = AnyBook.getTitle(); // Dont write BookAuthors = bookauthors; this is wrong BookAuthors = new Author [ AnyBook.getBookAuthors().length ]; for (int index=0; index <BookAuthors.length; index++) { BookAuthors[index] = new Author ( AnyBook.getBookAuthors() [index]); BookPublisher = new Publisher (AnyBook.getBookPublisher()); Edition = AnyBook.getEdition(); YearPublished = AnyBook.getYearPublished(); the id public static int getid() { return ID; the title public String gettitle() { return Title; the bookauthors public Author[] getbookauthors() { return BookAuthors;

7 the bookpublisher public Publisher getbookpublisher() { return BookPublisher; the edition public int getedition() { return Edition; the yearpublished public int getyearpublished() { return YearPublished; id the id to set public static void setid(int id) { ID = id; title the title to set public void settitle(string title) { Title = title; bookauthors the bookauthors to set public void setbookauthors(author[] bookauthors) { BookAuthors = new Author [ bookauthors.length ]; for (int index=0; index <BookAuthors.length; index++) { BookAuthors[index] = new Author (bookauthors[index]);

8 bookpublisher the bookpublisher to set public void setbookpublisher(publisher bookpublisher) { BookPublisher = bookpublisher; edition the edition to set public void setedition(int edition) { Edition = edition; yearpublished the yearpublished to set public void setyearpublished(int yearpublished) { YearPublished = yearpublished;

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 03: Creating Classes MOUNA KACEM mouna@cs.wisc.edu Spring 2019 Creating Classes 2 Constructors and Object Initialization Static versus non-static fields/methods Encapsulation

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 03: Creating Classes MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Creating Classes 2 Constructors and Object Initialization Static versus non-static fields/methods Encapsulation

More information

InfiniteGraph Manual 1

InfiniteGraph Manual 1 InfiniteGraph Manual 1 Installation Steps: Run the InfiniteGraph.exe file. Click next. Specify the installation directory. Click next. Figure 1: Installation step 1 Figure 2: Installation step 2 2 Select

More information

public class Account { private int id; private static int nextaccountid = 0; private String name; private double balance;

public class Account { private int id; private static int nextaccountid = 0; private String name; private double balance; public class Account { private int id; private static int nextaccountid = 0; private String name; private double balance; public double deposit(double amount) { public double withdraw(double amount) {

More information

CMSC 132: Object-Oriented Programming II. Inheritance

CMSC 132: Object-Oriented Programming II. Inheritance CMSC 132: Object-Oriented Programming II Inheritance 1 Mustang vs Model T Ford Mustang Ford Model T 2 Interior: Mustang vs Model T 3 Frame: Mustang vs Model T Mustang Model T 4 Compaq: old and new Price:

More information

Java Classes, Inheritance, and Interfaces

Java Classes, Inheritance, and Interfaces Java Classes, Inheritance, and Interfaces Introduction Classes are a foundational element in Java. Everything in Java is contained in a class. Classes are used to create Objects which contain the functionality

More information

Darrell Bethea June 6, 2011

Darrell Bethea June 6, 2011 Darrell Bethea June 6, 2011 Program 4 due Friday Testing/debugging help online Final exam Comprehensive Monday, 6/13, 8-11 AM SN014 2 3 Inheritance 4 We have discussed before how classes of objects can

More information

A506 / C201 Computer Programming II Placement Exam Sample Questions. For each of the following, choose the most appropriate answer (2pts each).

A506 / C201 Computer Programming II Placement Exam Sample Questions. For each of the following, choose the most appropriate answer (2pts each). A506 / C201 Computer Programming II Placement Exam Sample Questions For each of the following, choose the most appropriate answer (2pts each). 1. Which of the following functions is causing a temporary

More information

Model Driven Architecture with Java

Model Driven Architecture with Java Model Driven Architecture with Java Gregory Cranz Solutions Architect Arrow Electronics, Inc. V20061005.1351 Page Number.1 Who am I? Solutions Architect Software Developer Java Early Adopter Page Number.2

More information

CS/ENGRD 2110 SPRING Lecture 2: Objects and classes in Java

CS/ENGRD 2110 SPRING Lecture 2: Objects and classes in Java 1 CS/ENGRD 2110 SPRING 2017 Lecture 2: Objects and classes in Java http://courses.cs.cornell.edu/cs2110 CMS VideoNote.com, PPT slides, DrJava, Book 2 CMS available. Visit course webpage, click Links, then

More information

Step By Step Guideline for Building & Running HelloWorld Hibernate Application

Step By Step Guideline for Building & Running HelloWorld Hibernate Application Step By Step Guideline for Building & Running HelloWorld Hibernate Application 1 What we are going to build A simple Hibernate application persisting Person objects The database table, person, has the

More information

The most common relationships are: dependency, association, generalization, and realization.

The most common relationships are: dependency, association, generalization, and realization. UML Class Diagram A class diagram describes the structure of an object-oriented system by showing the classes (and interfaces) in that system and the relationships between the classes (and interfaces).

More information

Updates. Office B116E Office Hours : Friday 1 p.m. 2 p.m. Also by appointment Office Hours Purpose:

Updates. Office B116E Office Hours : Friday 1 p.m. 2 p.m. Also by appointment Office Hours Purpose: CS 180 Amit Gupta Updates Office B116E Office Hours : Friday 1 p.m. 2 p.m. Also by appointment gupta75@purdue.edu Office Hours Purpose: Course Material and Recitation No project questions Quizzes I will

More information

Getter and Setter Methods

Getter and Setter Methods Example 1 namespace ConsoleApplication14 public class Student public int ID; public string Name; public int Passmark = 50; class Program static void Main(string[] args) Student c1 = new Student(); Console.WriteLine("please..enter

More information

CS/ENGRD 2110 SPRING Lecture 2: Objects and classes in Java

CS/ENGRD 2110 SPRING Lecture 2: Objects and classes in Java 1 CS/ENGRD 2110 SPRING 2014 Lecture 2: Objects and classes in Java http://courses.cs.cornell.edu/cs2110 Java OO (Object Orientation) 2 Python and Matlab have objects and classes. Strong-typing nature of

More information

Exam 1 on Abstract Data Types and Java

Exam 1 on Abstract Data Types and Java 1 Com S 362 Fall 2003 Name: Object-Oriented Analysis and Design Exam 1 on Abstract Data Types and Java This test has 3 questions and pages numbered 1 through 14. Reminders This test is open book and notes.

More information

Running the program (the model) simulates what would

Running the program (the model) simulates what would CSE 143 Programming as Modeling Reading: Ch. 1-6 Building Virtual Worlds Much of programming can be viewed as building a model of a real or imaginary world in the computer a banking program models real

More information

MYBATIS - ANNOTATIONS

MYBATIS - ANNOTATIONS MYBATIS - ANNOTATIONS http://www.tutorialspoint.com/mybatis/mybatis_annotations.htm Copyright tutorialspoint.com In the previous chapters, we have seen how to perform curd operations using MyBatis. There

More information

Readings for This Lecture

Readings for This Lecture Lecture 4 Classes Readings for This Lecture Section 1.4, 1.5 in text Section 3.1 in text Plive activities referenced in the text Please look at lecture summaries online Handouts are short version Presentation

More information

EXAMINATION FOR THE DIPLOMA IN INFORMATION TECHNOLOGY; YEAR 2

EXAMINATION FOR THE DIPLOMA IN INFORMATION TECHNOLOGY; YEAR 2 FACULTY OF SCIENCE AND TECHNOLOGY EXAMINATION FOR THE DIPLOMA IN INFORMATION TECHNOLOGY; YEAR 2 SAMPLE QUESTION Question 1 A class called TV is required by a programmer who is writing software for a retail

More information

Learn more about our research, discover data science, and find other great resources at:

Learn more about our research, discover data science, and find other great resources at: Learn more about our research, discover data science, and find other great resources at: http://www.dataminingapps.com Chapter 7 Delving Further into Object- Oriented Concepts Overview Annotations Overloading

More information

Binghamton University. CS-140 Fall Problem Solving. Creating a class from scratch

Binghamton University. CS-140 Fall Problem Solving. Creating a class from scratch Problem Solving Creating a class from scratch 1 Recipe for Writing a Class 1. Write the class boilerplate stuff 2. Declare Fields 3. Write Creator(s) 4. Write accessor methods 5. Write mutator methods

More information

Programming 2. Object Oriented Programming. Daniel POP

Programming 2. Object Oriented Programming. Daniel POP Programming 2 Object Oriented Programming Daniel POP Week 2 Agenda 1. Basic OOP concepts 1. Class 2. Object 3. Message 2. Scopes 3. Classes 1. Declaration 2. Implementation 3. Accessing class members 4.

More information

A simple, scalable app architecture with Android Annotations Luke Sleeman Freelance Android developer lukesleeman.com.au

A simple, scalable app architecture with Android Annotations Luke Sleeman Freelance Android developer lukesleeman.com.au A simple, scalable app architecture with Android Annotations Luke Sleeman Freelance Android developer lukesleeman.com.au Image CC: https://flic.kr/p/6oqczb Agenda Introduction The architecture - History,

More information

Do not open this examination paper until instructed to do so. Answer all the questions.

Do not open this examination paper until instructed to do so. Answer all the questions. N08/5/COMSC/HP2/ENG/TZ0/XX 88087012 Computer science HIGHER level Paper 2 Monday 17 November 2008 (morning) 2 hours 15 minutes INSTRUCTIONS TO CANDIDATES Do not open this examination paper until instructed

More information

Abstract Classes and Interfaces

Abstract Classes and Interfaces Abstract Classes and Interfaces Reading: Reges and Stepp: 9.5 9.6 CSC216: Programming Concepts Sarah Heckman 1 Abstract Classes A Java class that cannot be instantiated, but instead serves as a superclass

More information

CS/ENGRD 2110 SPRING Lecture 5: Local vars; Inside-out rule; constructors

CS/ENGRD 2110 SPRING Lecture 5: Local vars; Inside-out rule; constructors 1 CS/ENGRD 2110 SPRING 2017 Lecture 5: Local vars; Inside-out rule; constructors http://courses.cs.cornell.edu/cs2110 Announcements 2 1. Writing tests to check that the code works when the precondition

More information

Create a Java project named week10

Create a Java project named week10 Objectives of today s lab: Through this lab, students will examine how casting works in Java and learn about Abstract Class and in Java with examples. Create a Java project named week10 Create a package

More information

Model-based Software Engineering (02341, Spring 2017) Ekkart Kindler

Model-based Software Engineering (02341, Spring 2017) Ekkart Kindler Model-based Software Engineering (02341, Spring 2017) Code snippets (week 2) Ecore model from T01 3 Generated Code // All comments and imports deleted! package dk.dtu.compute.mbse.petrinet; Interface only

More information

Tutorial 12. Exercise 1: Exercise 2: CSC111 Computer Programming I

Tutorial 12. Exercise 1: Exercise 2: CSC111 Computer Programming I College of Computer and Information Sciences CSC111 Computer Programming I Exercise 1: Tutorial 12 Arrays: A. Write a method add that receives an array of integers arr, the number of the elements in the

More information

General computer science term that is described as a set of data and a set of operations(methods)to manipulate the data.

General computer science term that is described as a set of data and a set of operations(methods)to manipulate the data. Interface that is implemented for classes that need to be ordererd Method that classes *should* almost always have for instances so that instances can be output nicely List structure with only sequential

More information

CIT Special final examination

CIT Special final examination CIT 590-2016 Special final examination Name (please write your official name) PennID Number Note that your PennID number is the 8 digit bold number on your penn card. DO NOT START WRITING (aside from name

More information

Practice problem on defining and using Class types. Part 4.

Practice problem on defining and using Class types. Part 4. CS180 Programming Fundamentals Practice problem on defining and using Class types. Part 4. Implementing object associations: Applications typically consist of collections of objects of different related

More information

Object O - riented Databases db4o: Part 1

Object O - riented Databases db4o: Part 1 Object-Oriented Oi t ddatabases db4o: Part 1 Managing Databases, Storing and Retrieving Objects Query by Example, Native Queries, SODA Simple and Complex Objects, Activation, Transactions Introducing db4o

More information

Kotlin for Android Developers

Kotlin for Android Developers Kotlin for Android Developers Learn Kotlin the easy way while developing an Android App Antonio Leiva This book is for sale at http://leanpub.com/kotlin-for-android-developers This version was published

More information

Within a source file or class we find the typical layout of file MyClass.java : [/* * header comment, for CVS, IP issues, etc. */] [package foo;]

Within a source file or class we find the typical layout of file MyClass.java : [/* * header comment, for CVS, IP issues, etc. */] [package foo;] Producing Production Quality Software Lecture 9: System Design in Java Prof. Arthur P. Goldberg Fall, 2005 Small scale Within a source file or class we find the typical layout of file MyClass.java : [/*

More information

CS100J Prelim I, 29 Sept. 2003

CS100J Prelim I, 29 Sept. 2003 CS100J Prelim I, 29 Sept. 2003 CORNELL NETID NAME (PRINT LEGIBLY!) (last, first) Question 0 out of 02 This 90-minute exam has 6 questions worth a total of 100 points. Question 1 out of 20 We suggest that

More information

Kotlin for Android Developers

Kotlin for Android Developers Kotlin for Android Developers Learn Kotlin the easy way while developing an Android App Antonio Leiva This book is for sale at http://leanpub.com/kotlin-for-android-developers This version was published

More information

Do not turn over this examination paper until instructed to do so. Answer all questions.

Do not turn over this examination paper until instructed to do so. Answer all questions. IB Computer Science HL Paper 2 - Mock Exam - Dec 2017 (1/8) COMPUTER SCIENCE HIGHER LEVEL PAPER 2 MOCK EXAM 1 hour 20 minutes INSTRUCTIONS TO CANDIDATES Do not turn over this examination paper until instructed

More information

CS/ENGRD 2110 FALL Lecture 2: Objects and classes in Java

CS/ENGRD 2110 FALL Lecture 2: Objects and classes in Java 1 CS/ENGRD 2110 FALL 2017 Lecture 2: Objects and classes in Java http://courses.cs.cornell.edu/cs2110 CMS VideoNote.com, PPT slides, DrJava 2 CMS. Visit course webpage, click Links, then CMS for 2110.

More information

Data & Procedure Java review

Data & Procedure Java review Data & Procedure Java review The primary purpose of the studies in this book is to understand efficient computation, but throughout we study this via examples written using the Java programming language.

More information

CS/ENGRD 2110 SPRING Lecture 2: Objects and classes in Java

CS/ENGRD 2110 SPRING Lecture 2: Objects and classes in Java 1 CS/ENGRD 2110 SPRING 2018 Lecture 2: Objects and classes in Java http://courses.cs.cornell.edu/cs2110 Homework HW1 2 The answers you handed in at the end of lecture 1 showed mass confusion! Perhaps 80%

More information

Problem 1 Short Answers Why use the reserved words new or delete? Why use dynamic memory allocation?

Problem 1 Short Answers Why use the reserved words new or delete? Why use dynamic memory allocation? Problem 1 Short Answers Why use the reserved words new or delete? Why use dynamic memory allocation? What is a pointer? What is a reference variable? When would you use pointers over reference variables?

More information

Department of Civil and Environmental Engineering, Spring Semester, ENCE 688R: Final Exam: 2 Hours, Open Book and Open Notes

Department of Civil and Environmental Engineering, Spring Semester, ENCE 688R: Final Exam: 2 Hours, Open Book and Open Notes Department of Civil and Environmental Engineering, Spring Semester, 2017 ENCE 688R: Final Exam: 2 Hours, Open Book and Open Notes Name : Question Points Score 1 50 2 30 3 20 Total 100 1 Question 1: 50

More information

King Saud University College of Computer and Information Systems Department of Computer Science CSC 113: Java Programming-II, Spring 2016

King Saud University College of Computer and Information Systems Department of Computer Science CSC 113: Java Programming-II, Spring 2016 Create the classes along with the functionality given in the following UML Diagram. To understand the problem, please refer to the description given after the diagram. Node +Node(e:Employee) +getdata():employee

More information

C08: Inheritance and Polymorphism

C08: Inheritance and Polymorphism CISC 3120 C08: Inheritance and Polymorphism Hui Chen Department of Computer & Information Science CUNY Brooklyn College 2/26/2018 CUNY Brooklyn College 1 Outline Recap and issues Project progress? Practice

More information

CS/ENGRD 2110 FALL Lecture 5: Local vars; Inside-out rule; constructors

CS/ENGRD 2110 FALL Lecture 5: Local vars; Inside-out rule; constructors 1 CS/ENGRD 2110 FALL 2018 Lecture 5: Local vars; Inside-out rule; constructors http://courses.cs.cornell.edu/cs2110 Announcements 2 A1 is due tomorrow If you are working with a partner: form a group on

More information

A simple, scalable app architecture with Android annotations Luke Sleeman Freelance Android developer lukesleeman.com.au

A simple, scalable app architecture with Android annotations Luke Sleeman Freelance Android developer lukesleeman.com.au A simple, scalable app architecture with Android annotations Luke Sleeman Freelance Android developer lukesleeman.com.au Image CC: https://flic.kr/p/6oqczb Agenda Introduction The architecture - an overview

More information

Announcements for the Class

Announcements for the Class Lecture 2 Classes Announcements for the Class Readings Section 1.4, 1.5 in text Section 3.1 in text Optional: PLive CD that comes with text References in text Assignment Assignment 1 due next week Due

More information

The Object Class. java.lang.object. Important Methods In Object. Mark Allen Weiss Copyright 2000

The Object Class. java.lang.object. Important Methods In Object. Mark Allen Weiss Copyright 2000 The Object Class Mark Allen Weiss Copyright 2000 1/4/02 1 java.lang.object All classes either extend Object directly or indirectly. Makes it easier to write generic algorithms and data structures Makes

More information

G l a r i m y TeachCode Series. Hibernate. Illustrated. Krishna Mohan Koyya

G l a r i m y TeachCode Series. Hibernate. Illustrated. Krishna Mohan Koyya G l a r i m y TeachCode Series Hibernate Illustrated Krishna Mohan Koyya Basic Mapping Entities with XML Person.java import java.util.date; public class Person { private int id; private String name; private

More information

Goals for Today. CSE1030 Introduction to Computer Science II. CSE1030 Lecture #9. Review is-a versus has-a. Lecture #9 Inheritance I

Goals for Today. CSE1030 Introduction to Computer Science II. CSE1030 Lecture #9. Review is-a versus has-a. Lecture #9 Inheritance I CSE1030 Introduction to Computer Science II Lecture #9 Inheritance I Goals for Today Today we start discussing Inheritance (continued next lecture too) This is an important fundamental feature of Object

More information

Distributed Systems Recitation 1. Tamim Jabban

Distributed Systems Recitation 1. Tamim Jabban 15-440 Distributed Systems Recitation 1 Tamim Jabban Office Hours Office 1004 Sunday, Tuesday: 9:30-11:59 AM Appointment: send an e-mail Open door policy Java: Object Oriented Programming A programming

More information

CS100J Prelim 1 22 February 2007

CS100J Prelim 1 22 February 2007 NAME Cornell Net id 1/5 CS100J Prelim 1 22 February 2007 This 90-minute exam has 6 questions (numbered 0..5) worth a total of 100 points. Scan the whole test before starting. Budget your time wisely. Use

More information

Advanced Programming Methods. Seminar 12

Advanced Programming Methods. Seminar 12 Advanced Programming Methods Seminar 12 1. instanceof operator 2. Java Serialization Overview 3. Discuss how we can serialize our ToyLanguage interpreter. Please discuss the implementation of different

More information

CS/ENGRD 2110 FALL Lecture 5: Local vars; Inside-out rule; constructors

CS/ENGRD 2110 FALL Lecture 5: Local vars; Inside-out rule; constructors 1 CS/ENGRD 2110 FALL 2016 Lecture 5: Local vars; Inside-out rule; constructors http://courses.cs.cornell.edu/cs2110 References to text and JavaSummary.pptx 2 Local variable: variable declared in a method

More information

1B1b Classes in Java Part I

1B1b Classes in Java Part I 1B1b Classes in Java Part I Agenda Defining simple classes. Instance variables and methods. Objects. Object references. 1 2 Reading You should be reading: Part I chapters 6,9,10 And browsing: Part IV chapter

More information

CS/ENGRD 2110 FALL Lecture 2: Objects and classes in Java

CS/ENGRD 2110 FALL Lecture 2: Objects and classes in Java 1 CS/ENGRD 2110 FALL 2018 Lecture 2: Objects and classes in Java http://courses.cs.cornell.edu/cs2110 Homework HW1 2 The answers you handed in at the end of lecture 1 showed mass confusion! Perhaps 80%

More information

Software and Programming 1

Software and Programming 1 Software and Programming 1 Week 9 Lab - Use of Classes and Inheritance 8th March 2018 SP1-Lab9-2018.ppt Tobi Brodie (Tobi@dcs.bbk.ac.uk) 1 Lab 9: Objectives Exercise 1 Student & StudentTest classes 1.

More information

COE318 Lecture Notes Week 3 (Sept 19, 2011)

COE318 Lecture Notes Week 3 (Sept 19, 2011) COE318 Lecture Notes: Week 3 1 of 8 COE318 Lecture Notes Week 3 (Sept 19, 2011) Topics Announcements TurningRobot example PersonAge example Announcements The submit command now works. Quiz: Monday October

More information

1st Semester Examinations CITS1001 3

1st Semester Examinations CITS1001 3 1st Semester Examinations CITS1001 3 Question 1 (10 marks) Write a Java class Student with three fields: name, mark and maxscore representing a student who has scored mark out of maxscore. The class has

More information

Chain of Responsibility Pattern

Chain of Responsibility Pattern Chain of Responsibility Pattern As the name suggests, the chain of responsibility pattern creates a chain of receiver objects for a request. This pattern decouples sender and receiver of a request based

More information

Innovative and Pragmatic Java Source Code Generation. Nikolche Mihajlovski

Innovative and Pragmatic Java Source Code Generation. Nikolche Mihajlovski Innovative and Pragmatic Java Source Code Generation Nikolche Mihajlovski Introduction Hello, world! System.out.println("Hello, GeeCON world!"); Person me = new Person(); me.setfirstname("nikolche"); me.setlastname("mihajlovski");

More information

CSCI 111 Midterm Spring 2014

CSCI 111 Midterm Spring 2014 CSCI 111 Midterm Spring 2014 Question Number Point Value 1 40 2 20 3 15 4 25 Total 100 Points Awarded Name Student Id Lab Section 50 Minutes If I can t read your handwriting I have to count it wrong Keep

More information

Distributed Systems Recitation 1. Tamim Jabban

Distributed Systems Recitation 1. Tamim Jabban 15-440 Distributed Systems Recitation 1 Tamim Jabban Office Hours Office 1004 Tuesday: 9:30-11:59 AM Thursday: 10:30-11:59 AM Appointment: send an e-mail Open door policy Java: Object Oriented Programming

More information

RAFDA Run-Time (RRT) Beginner s Guide v1.0

RAFDA Run-Time (RRT) Beginner s Guide v1.0 RAFDA Run-Time (RRT) Beginner s Guide v1.0 Scott M. Walker RAFDA Project School of Computer Science University of St Andrews http://www-systems.dcs.st-and.ac.uk/rafda/ RRT Beginner s Guide v1.0 1 Abstract

More information

Object Oriented Relationships

Object Oriented Relationships Lecture 3 Object Oriented Relationships Group home page: http://groups.yahoo.com/group/java CS244/ 2 Object Oriented Relationships Object oriented programs usually consisted of a number of classes Only

More information

Sample file. Practice Exam One COMPUTER SCIENCE A SECTION I. Directions: Determine the answer to each of the following questions or incomplete

Sample file. Practice Exam One COMPUTER SCIENCE A SECTION I. Directions: Determine the answer to each of the following questions or incomplete Practice Exam One / Level A Diagnostic Test 5 Practice Exam One COMPUTER SCIENCE A SECTION I Time 1 hour and 15 minutes Number of questions 40 Percent of total grade 50 Directions: Determine the answer

More information

Guessing Game with Objects

Guessing Game with Objects Objectives Tasks Guessing Game with Objects 1. Practice writing an object-oriented program using different classes for different parts of the game. 2. Write code that is portable. Your application must

More information

Do not turn over this examination paper until instructed to do so. Answer all questions.

Do not turn over this examination paper until instructed to do so. Answer all questions. IB Computer Science SL Paper 2 - Mock Exam - Dec 2013 (1/6) COMPUTER SCIENCE STANDARD LEVEL PAPER 2 MOCK EXAM 1 hour INSTRUCTIONS TO CANDIDATES Do not turn over this examination paper until instructed

More information

Author: Sascha Wolski Sebastian Hennebrueder Tutorials for Struts, EJB, xdoclet and eclipse.

Author: Sascha Wolski Sebastian Hennebrueder   Tutorials for Struts, EJB, xdoclet and eclipse. Struts Nested Tags Since the version 1.1 of Struts, the tag library nested is included in Struts. In this tutorial we want to explain what are the features of the new nested tag library and show some little

More information

Abstract class & Interface

Abstract class & Interface Islamic University of Gaza Faculty of Engineering Computer Engineering Department Computer Programming Lab (ECOM 2124) Lab 3 Abstract class & Interface Eng. Mohammed Abdualal Abstract class 1. An abstract

More information

Day 3. COMP 1006/1406A Summer M. Jason Hinek Carleton University

Day 3. COMP 1006/1406A Summer M. Jason Hinek Carleton University Day 3 COMP 1006/1406A Summer 2016 M. Jason Hinek Carleton University today s agenda assignments 1 was due before class 2 is posted (be sure to read early!) a quick look back testing test cases for arrays

More information

How to evaluate a design? How to improve on it? When to stop evaluating and improving?

How to evaluate a design? How to improve on it? When to stop evaluating and improving? How to design code? Steps Analyze the problem (we will cover later) Come up with initial design Evaluate this design (is it good enough?) Improve design & repeat evaluation How to evaluate a design? How

More information

Midterm 2 Grading Key

Midterm 2 Grading Key Midterm 2 Grading Key Question Correct Answer Question Correct Answer 1 C A: LEGAL 2 A B: LEGAL 3 FALSE C: LEGAL 4 B or D D: LEGAL 7 5 E E: ILLEGAL 6 C F: LEGAL G: ILLEGAL H: LEGAL 8. Calling Constructors

More information

PASS4TEST IT 인증시험덤프전문사이트

PASS4TEST IT 인증시험덤프전문사이트 PASS4TEST IT 인증시험덤프전문사이트 http://www.pass4test.net 일년동안무료업데이트 Exam : 1z0-809 Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z0-809 Exam's Question and Answers 1 from

More information

Scala. Introduction. Scala

Scala. Introduction. Scala Scala Introduction 1 Scala Scala was proposed by Professor Martin Odersky and his group at EPFL in 2003 to provide a highperformance, concurrent-ready environment for functional programming and object-oriented

More information

Handout 8 Classes and Objects Continued: Static Variables and Constants.

Handout 8 Classes and Objects Continued: Static Variables and Constants. Handout 8 CS603 Object-Oriented Programming Fall 16 Page 1 of 8 Handout 8 Classes and Objects Continued: Static Variables and Constants. 1. Static variable Declared with keyword static One per class (instead

More information

Survey #2. Programming Assignment 3. Final Exam. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu.

Survey #2. Programming Assignment 3. Final Exam. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu Accessing the Superclass Object Hierarchies is-a, has-a Readings This Week: Ch 9.4-9.5 and into Ch 10.1-10.8 (Ch 11.4-11.5 and into

More information

EXAMINATION FOR THE BSC (HONS) INFORMATION TECHNOLOGY; BSC (HONS) INFORMATION SYSTEMS & BSC (HONS) COMPUTER SCIENCE; YEAR 1

EXAMINATION FOR THE BSC (HONS) INFORMATION TECHNOLOGY; BSC (HONS) INFORMATION SYSTEMS & BSC (HONS) COMPUTER SCIENCE; YEAR 1 FACULTY OF SCIENCE AND TECHNOLOGY EXAMINATION FOR THE BSC (HONS) INFORMATION TECHNOLOGY; BSC (HONS) INFORMATION SYSTEMS & BSC (HONS) COMPUTER SCIENCE; YEAR 1 ACADEMIC SESSION 2014; SEMESTER 2 PRG1203:

More information

Lecture 4: The class hierarchy; static components

Lecture 4: The class hierarchy; static components 1 CS/ENGRD 2110 FALL2017 Lecture 4: The class hierarchy; static components http://cs.cornell.edu/courses/cs2110 Announcements 2 A1 Due Thursday A2 Out Today Where am I? Big ideas so far. 3 Java variables

More information

Objects and State. COMP1400 Week 9. Wednesday, 19 September 12

Objects and State. COMP1400 Week 9. Wednesday, 19 September 12 Objects and State COMP1400 Week 9 Mutator methods The internal state of an object can change. We do this by changing the values contained in its fields. Methods that change an object's state are called

More information

16. Give a detailed algorithm for making a peanut butter and jelly sandwich.

16. Give a detailed algorithm for making a peanut butter and jelly sandwich. COSC120FinalExamReview2010 1. NamethetwotheoreticalmachinesthatCharlesBabbagedeveloped. 2. WhatwastheAntikytheraDevice? 3. Givethecodetodeclareanintegervariablecalledxandthenassignitthe number10. 4. Givethecodetoprintout

More information

COMPUTER SCIENCE A SECTION II

COMPUTER SCIENCE A SECTION II COMPUTER SCIENCE A SECTION II Time 1 hour and 4 minutes Number of questions 4 Percent of total score 0 Directions: SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Notes: Assume

More information

CPSC 233 Final Exam, Winter 2003 DEPARTMENT OF COMPUTER SCIENCE THE UNIVERSITY OF CALGARY Time: 120 minutes 100 marks total L02, L03, L04

CPSC 233 Final Exam, Winter 2003 DEPARTMENT OF COMPUTER SCIENCE THE UNIVERSITY OF CALGARY Time: 120 minutes 100 marks total L02, L03, L04 CPSC 233 Final Exam, Winter 2003 DEPARTMENT OF COMPUTER SCIENCE THE UNIVERSITY OF CALGARY Time: 120 minutes 100 marks total L02, L03, L04 First Name Last Name Check the box to indicate the lecture that

More information

Classes - Testing your classes. Make sure your classes do what you think

Classes - Testing your classes. Make sure your classes do what you think Classes - Testing your classes Make sure your classes do what you think Classes are there for creating objects Most classes in Java are blueprints for creating objects Objects have state and behaviour

More information

Topic 7: Inheritance. Reading: JBD Sections CMPS 12A Winter 2009 UCSC

Topic 7: Inheritance. Reading: JBD Sections CMPS 12A Winter 2009 UCSC Topic 7: Inheritance Reading: JBD Sections 7.1-7.6 1 A Quick Review of Objects and Classes! An object is an abstraction that models some thing or process! Examples of objects:! Students, Teachers, Classes,

More information

Static, Final & Memory Management

Static, Final & Memory Management Static, Final & Memory Management The static keyword What if you want to have only one piece of storage regardless of how many objects are created or even no objects are created? What if you need a method

More information

CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM

CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM Objectives Defining a wellformed method to check class invariants Using assert statements to check preconditions,

More information

Media Computation. Lecture 15.2, December 3, 2008 Steve Harrison

Media Computation. Lecture 15.2, December 3, 2008 Steve Harrison Media Computation Lecture 15.2, December 3, 2008 Steve Harrison Today -- new Stuff! Two kinds of methods: object class Creating Classes identifying objects and classes constructors adding a method, accessors

More information

CSIS 10A Practice Final Exam Solutions

CSIS 10A Practice Final Exam Solutions CSIS 10A Practice Final Exam Solutions 1) (5 points) What would be the output when the following code block executes? int a=3, b=8, c=2; if (a < b && b < c) b = b + 2; if ( b > 5 a < 3) a = a 1; if ( c!=

More information

The class Object. Lecture CS1122 Summer 2008

The class Object.  Lecture CS1122 Summer 2008 The class Object http://www.javaworld.com/javaworld/jw-01-1999/jw-01-object.html Lecture 10 -- CS1122 Summer 2008 Review Object is at the top of every hierarchy. Every class in Java has an IS-A relationship

More information

Introduction to Software Engineering in Java. Exceptions, I/O, and you++

Introduction to Software Engineering in Java. Exceptions, I/O, and you++ 6.092 - Introduction to Software Engineering in Java Lecture 8: Exceptions, I/O, and you++ Thursday, January 31 IAP 2008 Cite as: Evan Jones, Olivier Koch, and Usman Akeju, course materials for 6.092 Introduction

More information

public static boolean isoutside(int min, int max, int value)

public static boolean isoutside(int min, int max, int value) See the 2 APIs attached at the end of this worksheet. 1. Methods: Javadoc Complete the Javadoc comments for the following two methods from the API: (a) / @param @param @param @return @pre. / public static

More information

Sorting Algorithms part 1

Sorting Algorithms part 1 Sorting Algorithms part 1 1. Bubble sort Description Bubble sort is a simple sorting algorithm. It works by repeatedly stepping through the array to be sorted, comparing two items at a time, swapping these

More information

EECS 1001 and EECS 1030M, lab 01 conflict

EECS 1001 and EECS 1030M, lab 01 conflict EECS 1001 and EECS 1030M, lab 01 conflict Those students who are taking EECS 1001 and who are enrolled in lab 01 of EECS 1030M should switch to lab 02. If you need my help with switching lab sections,

More information

Topic 7: Algebraic Data Types

Topic 7: Algebraic Data Types Topic 7: Algebraic Data Types 1 Recommended Exercises and Readings From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 5.5, 5.7, 5.8, 5.10, 5.11, 5.12, 5.14 14.4, 14.5, 14.6 14.9, 14.11,

More information

CS/ENGRD 2110 FALL2017. Lecture 4: The class hierarchy; static components

CS/ENGRD 2110 FALL2017. Lecture 4: The class hierarchy; static components 1 CS/ENGRD 2110 FALL2017 Lecture 4: The class hierarchy; static components http://cs.cornell.edu/courses/cs2110 Announcements 2 A0, HW1 due tonight Next week s recitation: loop invariants for ( ) { You

More information

Goals of the Lecture OO Programming Principles

Goals of the Lecture OO Programming Principles Goals of the Lecture OO Programming Principles Object-Oriented Analysis and Design - Fall 1998 n Discuss OO Programming Principles Ð Messages Ð Information Hiding Ð Classes and Instances Ð Inheritance

More information

Advanced MEIC. (Lesson #18)

Advanced MEIC. (Lesson #18) Advanced Programming @ MEIC (Lesson #18) Last class Data races Java Memory Model No out-of-thin-air values Data-race free programs behave as expected Today Finish with the Java Memory Model Introduction

More information