COMP15111: Introduction to Architecture
|
|
- Randall Collin McLaughlin
- 6 years ago
- Views:
Transcription
1 COMP15111 Lecture 9 1/33 COMP15111: Introduction to Architecture Lecture 9: Methods Pete Jinks School of Computer Science, University of Manchester Autumn 2011
2 COMP15111 Lecture 9 A Java Program 2/33 Lecture 9: You are here A Java Program Running A Java Program
3 OMP15111 Lecture 9 A Java Program 4/33 An example Java Program AgeHistory2 static int presentday, presentmonth, presentyear; void printagehistory (int person, birthday, birthmonth, birthyear) int someyear, ageinsomeyear1; System.out.println(...);... birthyear... presentyear... someyear... void main(string[] args) int birthday1, birthmonth1, birthyear1, = Integer.parseInt(args[...]); printagehistory(...); void println(string string) print(string); write(newline); void print(string string) write(nextchar);
4 COMP15111 Lecture 9 A Java Program 4/33 An example Java Program AgeHistory2 static int presentday, presentmonth, presentyear; void main(string[] args) int birthday1, birthmonth1, birthyear1, = Integer.parseInt(args[...]); printagehistory(...);
5 COMP15111 Lecture 9 A Java Program 4/33 An example Java Program AgeHistory2 static int presentday, presentmonth, presentyear; void printagehistory (int person, birthday, birthmonth, birthyear) int someyear, ageinsomeyear1; System.out.println(...);... birthyear... presentyear... someyear... void main(string[] args) int birthday1, birthmonth1, birthyear1, = Integer.parseInt(args[...]); printagehistory(...);
6 COMP15111 Lecture 9 A Java Program 4/33 An example Java Program AgeHistory2 static int presentday, presentmonth, presentyear; void printagehistory (int person, birthday, birthmonth, birthyear) int someyear, ageinsomeyear1; System.out.println(...);... birthyear... presentyear... someyear... void main(string[] args) int birthday1, birthmonth1, birthyear1, = Integer.parseInt(args[...]); printagehistory(...); void println(string string) print(string); write(newline);
7 COMP15111 Lecture 9 A Java Program 4/33 An example Java Program AgeHistory2 static int presentday, presentmonth, presentyear; void printagehistory (int person, birthday, birthmonth, birthyear) int someyear, ageinsomeyear1; System.out.println(...);... birthyear... presentyear... someyear... void main(string[] args) int birthday1, birthmonth1, birthyear1, = Integer.parseInt(args[...]); printagehistory(...); void println(string string) print(string); write(newline); void print(string string) write(nextchar);
8 COMP15111 Lecture 9 Running A Java Program 5/33 Lecture 9: You are here A Java Program Running A Java Program
9 COMP15111 Lecture 9 Running A Java Program 7/33 main starts
10 COMP15111 Lecture 9 Running A Java Program 9/33 parseint(...) main calls parseint (*6)
11 OMP15111 Lecture 9 Running A Java Program 11/33 parseint returns to main
12 COMP15111 Lecture 9 Running A Java Program 13/33 printagehistory(...) main calls printagehistory (*2)
13 COMP15111 Lecture 9 Running A Java Program 15/33 println(...) printagehistory(...) printagehistory calls println (*3?)
14 COMP15111 Lecture 9 Running A Java Program 17/33 print(...) println(...) printagehistory(...) println calls print
15 COMP15111 Lecture 9 Running A Java Program 19/33 write(...) print(...) println(...) printagehistory(...) print calls write (*n)
16 COMP15111 Lecture 9 Running A Java Program 21/33 print(...) println(...) printagehistory(...) write returns to print
17 COMP15111 Lecture 9 Running A Java Program 23/33 println(...) printagehistory(...) print returns to println
18 COMP15111 Lecture 9 Running A Java Program 25/33 write(...) println(...) printagehistory(...) println calls write
19 COMP15111 Lecture 9 Running A Java Program 27/33 println(...) printagehistory(...) write returns to println
20 COMP15111 Lecture 9 Running A Java Program 29/33 printagehistory(...) println returns to printagehistory
21 COMP15111 Lecture 9 Running A Java Program 31/33 printagehistory returns to main
22 COMP15111 Lecture 9 Running A Java Program 33/33 main finishes
26 Age history with a separate method 27 Method: void methods 28 Age history with a separate method 29 Age history with a separate method 33 Trying it
List of Slides 1 Title 2 Chapter 8: Separate methods and logical operators 3 Chapter aims 4 Section 2: Example:Age history with two people 5 Aim 6 Age history with two people 11 Trying it 12 Coursework:
More information(A) 99 (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution
Ch 5 Arrays Multiple Choice 01. An array is a (A) (B) (C) (D) data structure with one, or more, elements of the same type. data structure with LIFO access. data structure, which allows transfer between
More informationINDEX. A SIMPLE JAVA PROGRAM Class Declaration The Main Line. The Line Contains Three Keywords The Output Line
A SIMPLE JAVA PROGRAM Class Declaration The Main Line INDEX The Line Contains Three Keywords The Output Line COMMENTS Single Line Comment Multiline Comment Documentation Comment TYPE CASTING Implicit Type
More information(A) 99 ** (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution
Ch 5 Arrays Multiple Choice Test 01. An array is a ** (A) data structure with one, or more, elements of the same type. (B) data structure with LIFO access. (C) data structure, which allows transfer between
More informationLECTURE 2 (Gaya College of Engineering)
LECTURE 2 (Gaya College of Engineering) 1) CHARACTERISTICS OF OBJECTS: Object is an instance of a class. So, it is an active entity. Objects have three basic characteristics. They are- State: An object
More informationCP122 CS I. Iteration
CP122 CS I Iteration Tech News! Pix2Pix: machine learning translation of images https://affinelayer.com/pixsrv/ Tech News! Pix2Pix: machine learning translation of images https://affinelayer.com/pixsrv/
More information20 Minimum bit width 21 Minimum bit width 22 Design: pseudo code 24 Minimum bit width 25 Minimum bit width 26 Standard API: Math: pow() 27 Minimum bit
List of Slides 1 Title 2 Chapter 5: Repeated execution 3 Chapter aims 4 Section 2: Example:Minimum tank size 5 Aim 6 Minimum tank size 7 Execution: repeated execution 8 Statement: assignment statement:
More informationException Handling in Java. An Exception is a compile time / runtime error that breaks off the
Description Exception Handling in Java An Exception is a compile time / runtime error that breaks off the program s execution flow. These exceptions are accompanied with a system generated error message.
More informationLecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University
Lecture 2 COMP1406/1006 (the Java course) Fall 2013 M. Jason Hinek Carleton University today s agenda a quick look back (last Thursday) assignment 0 is posted and is due this Friday at 2pm Java compiling
More informationASSIGNMENT 1 Expressions, Data Types, and Simple Calculations
ASSIGNMENT 1 Expressions, Data Types, and Simple Calculations COMP-202B, Winter 2010, All Sections Due: Friday, January 22, 2010 (23:55) You MUST do this assignment individually and, unless otherwise specified,
More informationCOMP 110/L Lecture 7. Kyle Dewey
COMP 110/L Lecture 7 Kyle Dewey Outline Introduction to objects Constructors and new Instance variables Instance methods static vs. non-static Object-Oriented Programming Basic Idea The world is composed
More informationClasses and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable?
Peer Instruction 8 Classes and Objects How can multiple methods within a Java class read and write the same variable? A. Allow one method to reference a local variable of the other B. Declare a variable
More informationCS111: PROGRAMMING LANGUAGE II
CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 1(c): Java Basics (II) Lecture Contents Java basics (part II) Conditions Loops Methods Conditions & Branching Conditional Statements A
More informationCOMP26912: Algorithms and Imperative Programming
COMP26912 Lecture C4 1/28 COMP26912: Algorithms and Imperative Programming Lecture C4: C - Coping without Classes Pete Jinks School of Computer Science, University of Manchester Spring 2012 OMP26912 Lecture
More informationCSE 201 Java Programming I. Smart Coding School website:
CSE 201 Java Programming I Smart Coding School website: http://www.smartcodingschool.com Definition: A named group of statements public static void methodname() { statements Usage: 1. denotes the structure
More informationLecture 05: Methods. AITI Nigeria Summer 2012 University of Lagos.
Lecture 05: Methods AITI Nigeria Summer 2012 University of Lagos. Agenda What a method is Why we use methods How to declare a method The four parts of a method How to use (invoke) a method The purpose
More informationEXECUTION OF METHODS
EXECUTION OF METHODS Whenever one method calls a second, the JMV diverts execution control to the second method by jumping to its first statement. This second method may call other methods and so the process
More informationLesson 36: for() Loops (W11D1)
Lesson 36: for() Loops (W11D1) Balboa High School Michael Ferraro October 26, 2015 1 / 27 Do Now Create a new project: Lesson36 Write class FirstForLoop: Include a main() method: public static void main(string[]
More informationCP122 CS I. Chapter 13: Recursion
CP122 CS I Chapter 13: Recursion Russian law banning VPNs comes into effect today Tech News! Tech News! Russian law banning VPNs comes into effect today Shelley: AI to write horror story openings THE PATH
More informationFinal Examination Semester 2 / Year 2011
Southern College Kolej Selatan 南方学院 Final Examination Semester 2 / Year 2011 COURSE : FUNDAMENTALS OF SOFTWARE DESIGEN AND DEVELOPMENT COURSE CODE : PROG1003 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE
More informationCOMP 110/L Lecture 5. Kyle Dewey
COMP 110/L Lecture 5 Kyle Dewey Outlines Methods Defining methods Calling methods Methods Motivation Motivation Input Program Output -Start off with some high-level motivation -You write your program,
More informationActivity 4: Methods. Content Learning Objectives. Process Skill Goals
Activity 4: Methods Java programs are organized into classes, each of which has one or more methods, each of which has one or more statements. Writing methods allows you to break down a complex program
More informationBuilding Java Programs
Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading: 2.1-2.2 1 Data and expressions reading: 2.1 self-check: 1-4 videos: Ch. 2 #1 2 Data types type: A category or set of data
More informationFrom last time. What is the effect on R0 (in terms of an equivalent multiplication) of each of the following ARM instructions? ADD R0, R0, R0,LSL #3
OMP15111 Lecture 9 1/26 From last time What is the effect on R0 (in terms of an equivalent multiplication) of each of the following ARM instructions? ADD R0, R0, R0,LSL #3 RSB R0, R0, R0,LSL #2 Write down
More informationCOMP26120: Algorithms and Imperative Programming
COMP26120 Lecture C1 1/25 COMP26120: Algorithms and Imperative Programming Lecture C1: Introduction to C Pete Jinks School of Computer Science, University of Manchester Autumn 2011 COMP26120 Lecture C1
More informationConstants. Why Use Constants? main Method Arguments. CS256 Computer Science I Kevin Sahr, PhD. Lecture 25: Miscellaneous
CS256 Computer Science I Kevin Sahr, PhD Lecture 25: Miscellaneous 1 main Method Arguments recall the method header of the main method note the argument list public static void main (String [] args) we
More informationCONDITIONAL EXECUTION
CONDITIONAL EXECUTION yes x > y? no max = x; max = y; logical AND logical OR logical NOT &&! Fundamentals of Computer Science I Outline Conditional Execution if then if then Nested if then statements Comparisons
More informationb. Suppose you enter input from the console, when you run the program. What is the output?
Part I. Show the printout of the following code: (write the printout next to each println statement if the println statement is executed in the program). a. Show the output of the following code: public
More informationMcGill University School of Computer Science COMP-202A Introduction to Computing 1
McGill University School of Computer Science COMP-202A Introduction to Computing 1 Midterm Exam Thursday, October 26, 2006, 18:00-20:00 (6:00 8:00 PM) Instructors: Mathieu Petitpas, Shah Asaduzzaman, Sherif
More informationWarmup : Name that tune!
Warmup : Name that tune! Write, using a loop, Java code to print the lyrics to the song 99 Bottles of Beer on the Wall 99 bottles of beer on the wall. 99 bottles of beer. Take one down, pass it around,
More informationBuilding Java Programs
Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading: 2.1-2.2 Copyright 2009 by Pearson Education Data and expressions reading: 2.1 self-check: 1-4 videos: Ch. 2 #1 Copyright
More informationFaculty of Science COMP-202A - Foundations of Computing (Fall 2012) - All Sections Midterm Examination
First Name: Last Name: McGill ID: Section: Faculty of Science COMP-202A - Foundations of Computing (Fall 2012) - All Sections Midterm Examination November 7th, 2012 Examiners: Daniel Pomerantz [Sections
More informationC212 Early Evaluation Exam Mon Feb Name: Please provide brief (common sense) justifications with your answers below.
C212 Early Evaluation Exam Mon Feb 10 2014 Name: Please provide brief (common sense) justifications with your answers below. 1. What is the type (and value) of this expression: 5 * (7 + 4 / 2) 2. What
More informationMore on Exception Handling
Chapter 18 More on Exception Handling Lecture slides for: Java Actually: A Comprehensive Primer in Programming Khalid Azim Mughal, Torill Hamre, Rolf W. Rasmussen Cengage Learning, 2008. ISBN: 978-1-844480-933-2
More informationCSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall Office hours:
CSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall alphonce@buffalo.edu Office hours: Tuesday 10:00 AM 12:00 PM * Wednesday 4:00 PM 5:00 PM Friday 11:00 AM 12:00 PM OR
More informationClass 9: Static Methods and Data Members
Introduction to Computation and Problem Solving Class 9: Static Methods and Data Members Prof. Steven R. Lerman and Dr. V. Judson Harward Goals This the session in which we explain what static means. You
More informationCourse Content. Objectives of Lecture 22 File Input/Output. Outline of Lecture 22. CMPUT 102: File Input/Output Dr. Osmar R.
Structural Programming and Data Structures Winter 2000 CMPUT 102: Input/Output Dr. Osmar R. Zaïane Course Content Introduction Objects Methods Tracing Programs Object State Sharing resources Selection
More informationCONDITIONAL EXECUTION
CONDITIONAL EXECUTION yes x > y? no max = x; max = y; logical AND logical OR logical NOT &&! Fundamentals of Computer Science I Outline Conditional Execution if then if then Nested if then statements Comparisons
More informationCOMP 110/L Lecture 13. Kyle Dewey
COMP 110/L Lecture 13 Kyle Dewey Outline char, charat() Command-line arguments and arrays Array access Array length Array update Integer.parseInt char, charat() char Represents a single character char
More informationSDKs - Eclipse. SENG 403, Tutorial 2
SDKs - SENG 403, Tutorial 2 AGENDA - SDK Basics - - How to create Project - How to create a Class - Run Program - Debug Program SDK Basics Software Development Kit is a set of software development tools
More informationCOMP200 INPUT/OUTPUT. OOP using Java, based on slides by Shayan Javed
1 1 COMP200 INPUT/OUTPUT OOP using Java, based on slides by Shayan Javed Input/Output (IO) 2 3 I/O So far we have looked at modeling classes 4 I/O So far we have looked at modeling classes Not much in
More informationJava Classes: Math, Integer A C S L E C T U R E 8
Java Classes: Math, Integer A C S - 1903 L E C T U R E 8 Math class Math class is a utility class You cannot create an instance of Math All references to constants and methods will use the prefix Math.
More informationSequence structure. The computer executes java statements one after the other in the order in which they are written. Total = total +grade;
Control Statements Control Statements All programs could be written in terms of only one of three control structures: Sequence Structure Selection Structure Repetition Structure Sequence structure The
More informationCT 229 Methods Continued
CT 229 Methods Continued 13/10/2006 CT229 Lab Assignments Due Date for current lab assignment : Oct 20 th In Part 1 of Assignment you can declare a constant 3.14 to use as PI or you can use Math.PI Formula
More informationCOMP-202. Objects, Part III. COMP Objects Part III, 2013 Jörg Kienzle and others
COMP-202 Objects, Part III Lecture Outline Static Member Variables Parameter Passing Scopes Encapsulation Overloaded Methods Foundations of Object-Orientation 2 Static Member Variables So far, member variables
More information1. Find the output of following java program. class MainClass { public static void main (String arg[])
1. Find the output of following java program. public static void main(string arg[]) int arr[][]=4,3,2,1; int i,j; for(i=1;i>-1;i--) for(j=1;j>-1;j--) System.out.print(arr[i][j]); 1234 The above java program
More informationAnnouncements. Lab 03 inbase late submissions Midterm #1 Friday. Project 2 is posted. Covers everything through basics of OOP
Announcements Lab 03 inbase late submissions Midterm #1 Friday Covers everything through basics of OOP Project 2 is posted Due next Wednesday All about nested loops good exam practice Coding style is part
More informationBuilding Java Programs
Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading: 2.1-2.2 1 Variables reading: 2.2 self-check: 1-15 exercises: 1-4 videos: Ch. 2 #2 2 Receipt example What's bad about the
More informationJAVA OPERATORS GENERAL
JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators
More informationUniversity of Palestine. Mid Exam Total Grade: 100
First Question No. of Branches (5) A) Choose the correct answer: 1. If we type: system.out.println( a ); in the main() method, what will be the result? int a=12; //in the global space... void f() { int
More informationOperators Questions
Operators Questions https://www.geeksforgeeks.org/java-operators-question-1/ https://www.indiabix.com/java-programming/operators-andassignments/ http://www.instanceofjava.com/2015/07/increment-decrementoperators-interview.html
More informationObject-Oriented Concepts
JAC444 - Lecture 3 Object-Oriented Concepts Segment 2 Inheritance 1 Classes Segment 2 Inheritance In this segment you will be learning about: Inheritance Overriding Final Methods and Classes Implementing
More informationC16b: Exception Handling
CISC 3120 C16b: Exception Handling Hui Chen Department of Computer & Information Science CUNY Brooklyn College 3/28/2018 CUNY Brooklyn College 1 Outline Exceptions Catch and handle exceptions (try/catch)
More informationIntroduction to JAVA
Java A001 Hello World Let's study the entire program below: Introduction to JAVA // The "A001" class. import java.awt.*; public class A001 { public static void main (String[] args) { System.out.println("Hello
More informationTUGCE KEMEROZ - ASLI OZKAN - AYSE TARTAN. Week 12/02/ /02/2007 Lecture Notes:
1 INSTRUCTOR: FAZLI CAN TUGCE KEMEROZ - ASLI OZKAN - AYSE TARTAN Week 12/02/2007-16/02/2007 Lecture Notes: When we write a program we must design our programs to take correct output. For correct output,
More informationCOMP102: Test. 18 April, 2005
Name:.................................. ID Number:............................. Signature:............................... COMP102: Test 18 April, 2005 Instructions Time allowed: 1 1 2 hours. Answer all
More informationCSE 201 JAVA PROGRAMMING I. Copyright 2016 by Smart Coding School
CSE 201 JAVA PROGRAMMING I Primitive Data Type Primitive Data Type 8-bit signed Two s complement Integer -128 ~ 127 Primitive Data Type 16-bit signed Two s complement Integer -32768 ~ 32767 Primitive Data
More informationENGI 1020 Introduction to Computer Programming J U L Y 5, R E Z A S H A H I D I
ENGI 1020 Introduction to Computer Programming J U L Y 5, 2 0 1 0 R E Z A S H A H I D I Passing by value Recall that it is possible to call functions with variable names different than the parameters in
More informationUniversity of Cape Town ~ Department of Computer Science Computer Science 1015F ~ Test 2. Question Max Mark Internal External
Name: Please fill in your Student Number and Name. Student Number : Student Number: University of Cape Town ~ Department of Computer Science Computer Science 1015F ~ 2009 Test 2 Question Max Mark Internal
More informationCOMP 110/L Lecture 6. Kyle Dewey
COMP 110/L Lecture 6 Kyle Dewey Outline Methods Variable scope Call-by-value Testing with JUnit Variable Scope Question Does this compile? public class Test { public static void main(string[] args) { int
More informationCOS 126 Exam Review. Exams overview Example programming exam Example written exam questions (part 1)
COS 126 Exam Review Exams overview Example programming exam Example written exam questions (part 1) Exams overview (revisited) We have exams in the fall Two written exams. Two programming exams. Prep sessions
More informationNested Loops. A loop can be nested inside another loop.
Nested Loops A loop can be nested inside another loop. Nested loops consist of an outer loop and one or more inner loops. Each time the outer loop is repeated, the inner loops are reentered, and started
More informationCS 231 Data Structures and Algorithms Fall Arrays Lecture 07 - September 19, Prof. Zadia Codabux
CS 231 Data Structures and Algorithms Fall 2018 Arrays Lecture 07 - September 19, 2018 Prof. Zadia Codabux 1 Agenda Arrays For Each Loop 2D Arrays 2 Administrative None 3 Arrays 4 Array Data structure
More informationMore on Classes. 1 tostring
More on Classes 1 tostring Java allows us to supply an object wherever a string is expected. The run-time system will automatically apply a conversion function to create a string representation of the
More informationProgramming with Java
Programming with Java Variables and Output Statement Lecture 03 First stage Software Engineering Dep. Saman M. Omer 2017-2018 Objectives ü Declare and assign values to variable ü How to use eclipse ü What
More informationOptions for User Input
Options for User Input Options for getting information from the user Write event-driven code Con: requires a significant amount of new code to set-up Pro: the most versatile. Use System.in Con: less versatile
More informationCOMP6700/2140 Std. Lib., I/O
COMP6700/2140 Std Lib, I/O Alexei B Khorev and Joshua Milthorpe Research School of Computer Science, ANU February 2017 Alexei B Khorev and Joshua Milthorpe (RSCS, ANU) COMP6700/2140 Std Lib, I/O February
More informationLecture 5: Methods CS2301
Lecture 5: Methods NADA ALZAHRANI CS2301 1 Opening Problem Find the sum of integers from 1 to 10, from 20 to 30, and from 35 to 45, respectively. 2 Solution public static int sum(int i1, int i2) { int
More informationCSc 2010 Principles of Computer Science, Fall 2013 Practice Problems for Midterm 3* * 3 17 % 9-20 % (26 / 7) "2"
CSc 2010 Principles of Computer Science, Fall 2013 Practice Problems for Midterm 1. For each Java expression in the left hand column, indicate its value in the right hand column. Be sure to show a constant
More informationCOSC 236 Section 101 Computer Science 1 -- Prof. Michael A. Soderstrand
COSC 236 Section 101 Computer Science 1 -- Prof. Michael A. Soderstrand COSC 236 Web Site You will always find the course material at: http://www.class-notes.us From this site you can click on the COSC-236
More informationGetting started with Java
Getting started with Java Magic Lines public class MagicLines { public static void main(string[] args) { } } Comments Comments are lines in your code that get ignored during execution. Good for leaving
More informationCS1083 Week 2: Arrays, ArrayList
CS1083 Week 2: Arrays, ArrayList mostly review David Bremner 2018-01-08 Arrays (1D) Declaring and using 2D Arrays 2D Array Example ArrayList and Generics Multiple references to an array d o u b l e prices
More informationSelected Questions from by Nageshwara Rao
Selected Questions from http://way2java.com by Nageshwara Rao Swaminathan J Amrita University swaminathanj@am.amrita.edu November 24, 2016 Swaminathan J (Amrita University) way2java.com (Nageshwara Rao)
More informationArray. Lecture 12. Based on Slides of Dr. Norazah Yusof
Array Lecture 12 Based on Slides of Dr. Norazah Yusof 1 Introducing Arrays Array is a data structure that represents a collection of the same types of data. In Java, array is an object that can store a
More informationBuilding Java Programs
Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading: 2.1-2.2 1 2 Data and expressions reading: 2.1 3 The computer s view Internally, computers store everything as 1 s and 0
More informationWeek 6 CS 302. Jim Williams, PhD
Week 6 CS 302 Jim Williams, PhD This Week Lab: Multi-dimensional Arrays Exam 1: Thursday Lecture: Methods Review Midterm Exam 1 What is the location of the exam? 3650 Humanities 125 Ag Hall 272 Bascom
More informationLec 7. for loops and methods
Lec 7 for loops and methods Announcements Quiz 1 on Friday Review today. 5:00. CENTR 212 Assume there s a method drawrandomfruit() How would you create this: While loops final int DIMENSION = 9; int row
More informationWarm up question. 2)Which of the following operators are defined on a half integer? Which of the following would it be useful to write as behaviors?
Warm up question Suppose we have defined a class called half-integer The point of the class is to be able to store regular integers and also half integers (i.e. 3.5) 1)What would be a good way to represent
More informationFaculty of Science COMP-202A - Introduction to Computing I (Fall 2008) Midterm Examination
First Name: Last Name: McGill ID: Section: Faculty of Science COMP-202A - Introduction to Computing I (Fall 2008) Midterm Examination Tuesday, November 4, 2008 Examiners: Mathieu Petitpas [Section 1] 18:30
More informationJava Simple Data Types
Intro to Java Unit 1 Multiple Choice Java Simple Data Types DO NOT WRITE ON THIS TEST This test includes program segments, which are not complete programs. Answer such questions with the assumption that
More informationObjects as a programming concept
Objects as a programming concept IB Computer Science Content developed by Dartford Grammar School Computer Science Department HL Topics 1-7, D1-4 1: System design 2: Computer Organisation 3: Networks 4:
More informationAP Computer Science Summer Assignment (updated 5/29/2018) DUE : Sept. 4, 2018
AP Computer Science 2018 2019 E-mail: taegoode@vbschools.com Summer Assignment (updated 5/29/2018) DUE : Sept. 4, 2018 This assignment is due on the first day of class. Please read the instructions carefully
More informationCOMP-202. Recursion. COMP Recursion, 2011 Jörg Kienzle and others
COMP-202 Recursion Recursion Recursive Definitions Run-time Stacks Recursive Programming Recursion vs. Iteration Indirect Recursion Lecture Outline 2 Recursive Definitions (1) A recursive definition is
More informationCIS 110 Fall 2016 Introduction to Computer Programming 13 Oct 2016 Midterm Exam Answer Key
CIS 110 Fall 2016 Midterm 1 CIS 110 Fall 2016 Introduction to Computer Programming 13 Oct 2016 Midterm Exam Answer Key 1.) The Easy One (1 point total) Check cover sheet for name, recitation #, PennKey,
More informationLecture Notes CPSC 224 (Spring 2012) Today... Java basics. S. Bowers 1 of 8
Today... Java basics S. Bowers 1 of 8 Java main method (cont.) In Java, main looks like this: public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); Q: How
More informationTitle. Java Just in Time. John Latham. October 25, October 25, 2017 Java Just in Time - John Latham Page 1(0/0)
List of Slides 1 Title 2 Chapter 6: Control statements nested in loops 3 Chapter aims 4 Section 2: Example:Film certificate age checking the whole queue 5 Aim 6 Statement: statements can be nested within
More informationCMPT 125: Lecture 4 Conditionals and Loops
CMPT 125: Lecture 4 Conditionals and Loops Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 17, 2009 1 Flow of Control The order in which statements are executed
More informationCS Week 2. Jim Williams, PhD
CS 200 - Week 2 Jim Williams, PhD Society of Women Engineers "Not just for women and not just for engineers; all students are welcome. We are especially looking for more computer science students!" - Emile
More informationJava Socket Workshop. July Purpose of this workshop:
Java Socket Workshop July 2012 Purpose of this workshop: The objective of this workshop is to gain experience with writing and compiling programs using the Java programming language. The exercises provide
More informationESC101 : Fundamental of Computing
ESC101 : Fundamental of Computing End Semester Exam 19 November 2008 Name : Roll No. : Section : Note : Read the instructions carefully 1. You will lose 3 marks if you forget to write your name, roll number,
More informationCSE 142, Summer 2014
CSE 142, Summer 2014 Lecture 2: Static Methods Expressions reading: 1.4 2.1 Algorithms algorithm: A list of steps for solving a problem. Example algorithm: "Bake sugar cookies" Mix the dry ingredients.
More informationLesson 26: ArrayList (W08D1)
Lesson 26: ArrayList (W08D1) Balboa High School Michael Ferraro October 5, 2015 1 / 25 Do Now Prepare PS #4a (paper form) for pick-up! Consider the code below for powiter(), an iterative algorithm that
More information1.5 Input and Output. Introduction to Computer Science Sedgewick and Wayne Copyright 2007
1.5 Input and Output Introduction to Computer Science Sedgewick and Wayne Copyright 2007 http://introcs.cs.princeton.edu A Foundation for Programming any program you might want to write objects functions
More informationJava Simple Data Types
Intro to Java Unit 1 Multiple Choice Test Key Java Simple Data Types This Test Is a KEY DO NOT WRITE ON THIS TEST This test includes program segments, which are not complete programs. Answer such questions
More information1001ICT Introduction To Programming Lecture Notes
1001ICT Introduction To Programming Lecture Notes School of Information and Communication Technology Griffith University Semester 2, 2015 1 2 Elements of Java Java is a popular, modern, third generation
More informationLe L c e t c ur u e e 5 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Exception Handling
Course Name: Advanced Java Lecture 5 Topics to be covered Exception Handling Exception HandlingHandlingIntroduction An exception is an abnormal condition that arises in a code sequence at run time A Java
More informationMore on Exception Handling
Chapter 18 More on Exception Handling Lecture slides for: Java Actually: A Comprehensive Primer in Programming Khalid Azim Mughal, Torill Hamre, Rolf W. Rasmussen Cengage Learning, 2008. ISBN: 978-1-844480-933-2
More informationExplain briefly how starvation may occur in process scheduling. (2 marks)
OMP25111 Lecture 8 1/40 From last time Explain briefly how starvation may occur in process scheduling. (2 marks) In round-robin scheduling, new processes are typically placed at the end of the ready-state
More informationYou should now start on Chapter 4. Chapter 4 introduces the following concepts
Summary By this stage, you have met the following principles : the relationship between classes and objects that a class represents our understanding of something weʼre interested in, in a special and
More informationObject-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018
Object-oriented programming 1 and data-structures CS/ENGRD 2110 SUMMER 2018 Lecture 1: Types and Control Flow http://courses.cs.cornell.edu/cs2110/2018su Lecture 1 Outline 2 Languages Overview Imperative
More information