AP Computer Science A
|
|
- Melanie Randall
- 5 years ago
- Views:
Transcription
1 AP Computer Science A 2nd Quarter Notes Table of Contents - section links - Click on the date or topic below to jump to that section Date: 11/9/2017 Aim: Binary Numbers (lesson 14) Number Systems Date: 11/14/2017 Aim: Base Conversion (lesson 14) Base10toBase2: Base10toBaseX: Date: 11/20/2017 Aim: Review Classes, Constructors, & Methods (Lesson 15) Classes, Constructors & Methods Date: 11/27/2017 Aim: Introduction to Arrays (Lessons 18 & 19) An ARRAY is - Declaration & Initialization of arrays: The Arrays class & its common methods: Date: 12/8/2017 Aim: Arrays Creating an object that has another object as one of its properties Date: 12/18/2017 Aim: Arrays: Insert, Delete, Min, Max Finding Min & Max elements: Inserting elements into a sorted array: Deleting elements from a sorted array: Enhanced For Loop (for-each) Date: 1/5/2018 Aim: Static Methods & Static Variables (Lesson 20) Method use so far: Using a static method: Using a static variable: Static Methods & Variables used to-date: Static relationships: Date: 1/16/2018 Aim: Wrapper Classes, File Input & Output (Lessons 21-25) Wrapper Classes: Two main uses: File Input & Output: File Input: File Output: Finding a File s Path (in Windows): Formatting Examples:
2 Date : 11/9/2017 Aim : Binary Numbers (lesson 14) Number Systems Humans: Computers: Base 10 (decimal) 10 fingers Symbols 0-9 Base 2 (binary) Transistors with 2 settings: off (0) / on (1) ALL SOFTWARE > Machine (binary) code Binary Bit = 1 binary digit Groups: Nibble = 4 bits Byte = 8 bits Kilobyte (KB) = 1000 bytes Megabyte (MB) = 1000 kilobytes Gigabyte (GB) = 1000 megabytes Terabyte (TB) = 1000 gigabytes Date : 11/14/2017 Aim : Base Conversion (lesson 14) Base10toBase2: What variables are needed? What type of loop? What is the loop control variable? What will cause the loop to stop? How is the remainder calculated? How is the quotient calculated?. Convert 13 base-10 to base-2 2 ) base 10 = 1101 base 2. Convert 13 base-10 to base ) base 10 = D base 16 Base10toBaseX: What is different when converting to any other base? - Divide by the new base - Convert 2-digit remainders to a character (A - F)
3 Date : 11/20/2017 Aim : Review Classes, Constructors, & Methods (Lesson 15) Recall the following : public class Penguin{ private String name; public Penguin (...) { public return-type get () { public void set (params) { public String tostring () { // property; instance variable // constructor // accessor // mutator // tostring public class PenguinTester { public static void main (String args [ ]) { Classes, Constructors & Methods Class Property Modifier Behavior State Instance Variable Constructor method Accessor method Mutator method Local Variable - a blueprint for an object,defining its properties and behaviors (ie, car) - what the object has (ie, color, doors, mpg) - access outside of the class: public (yes) or private (no) - what the object does (ie, start, stop, fill up) - the combined values of all of an object s fields - declared outside of any method - relate to an instance of an object; ie an object s state private String color; - has a default value (0, null, etc.) - create objects using the blueprint public Car (); - retrieve information from the object public String getcolor ( ) { return color; - change information for the object public void setcolor (String c) { color = c; - defined inside a method - the scope is only within the body of that method - it must be initialized
4 Date : 11/27/2017 Aim : Introduction to Arrays (Lessons 18 & 19) An ARRAY is - - a container object that holds a fixed number of values of a single type - stored in memory as a contiguous block - given a set length when it is created - represented in java using brackets: int [ ] mynumarray = new int [10]; - Contiguous : next to / touching one another - Each element within an array is accessed by its numerical index - Index references begin with the number 0 - An array of length 10 has indices of 0-9 Declaration & Initialization of arrays: String[] flag1 = new String[5]; flag1[0] = A1 ; flag1[1] = B2 ; System.out.println(flag1[1]); String flag2[]={ C3, D4, E5 ; System.out.println(flag2[0]); char flag3[]=new char { a, b ; System.out.println(flag3[4]); >> IndexOutOfBounds Exception >> ArrayIndexOutOfBoundsException Length is a PROPERTY not a METHOD: int len = flag2.length; int len = flag2[0].length(); Arrays can be passed to methods, if the method has been written to accept one Different references to the same array String [] flag1 = new String { A, B, C ; String [] flag2 = flag1; // not a new array; points to the flag1 array []x vs. x[] GarbageCollector Physical versus logical size of an array Physical - number of elements that have been declared: i nt [] x = new int [5] ; Logical - number of elements that have been initialized: x[0] = 1; x[1] = 12 ;
5 The Arrays class & its common methods: Parsing / Splitting a string using a delimiter: String s = Hello. Goodbye. CUL8R ; String sp[]; sp = s.split(. ); //sp[0]= Hello, sp[1]= Goodbye, sp[2]= CUL8R Sorting elements within an array: int b[] = {104, 2, 19, 17, 34 ; // b[0]=104, b[1]=2, b[2]=19, etc. b[] Arrays.sort(b); // b[0]=2, b[1]=17, b[2]=19, etc. b[] Searching for an element in an array: int idx = Arrays.binarySearch(b, 109); Comparing length and contents of two arrays: boolean eq = Arrays.equals(x, y)); Date : 12/8/2017 Aim : Arrays Creating an object that has another object as one of its properties public class BankAccount { private String name; private double amount; public String tostring () { return... + name amount; public class BigBank { private BankAccount acct; private char type; public String tostring () { return acct.tostring() + in an account type + type +. ; Note: In BigBank, acct is a BankAccount object; therefore acct.tostring() references the tostring method in the BankAccount class
6 Date : 12/18/2017 Aim : Arrays: Insert, Delete, Min, Max Min and Max W Q G A C L S D Z V U K P Insert A B C D G K L P Q S U V W Z Delete A B C D K L P Q S U V W Z Finding Min & Max elements: Declare & Initialize variables String min =, max = ; Traverse the array Compare each element to the variable if (letter[i].compareto(min) < 0) If it is lower (or higher) replace the variable s current value with the new one min = letter[i]; W Q G A C L S D Z V U K P Inserting elements into a sorted array: Traverse the array, continuing while the element is less than the new object while (letter[i].compareto(n) < 0) Store the index where the object belongs ni = i; Move to the right all elements after the correct index, starting at the end letter[i] = letter[i-1]; Add the new object letter[ni] = n; A B C D G K L P Q S U V W Z
7 Deleting elements from a sorted array: Traverse the array looking for the object if (letter[i].compareto(d) == 0) Store the index of the object di = i; Move to the left all elements after the correct index, starting at the index letter[i] = letter[i+1]; A B C D K L P Q S U V W Z Enhanced For Loop (for-each) for (int i = 0; i < letters.length; i++) { System.out.println (letters[i]); // for each String element in String [] letters for (String s : letters) { System.out.println(s); A B C D K L P Q S U V W Z
8 Date : 1/5/2018 Aim : Static Methods & Static Variables (Lesson 20) Static methods and variables, also known as Class methods and variables: These methods and variables can be used without first creating an object. Method use so far: public class Pet { private String animal; private int numpaws; public Pet(String a) {animal=a; public void says (String c) {System.out.println(c); public class MakePet { public static void main (String args[]){ Pet pet1 = new Pet( cat ); pet1.says( meow ); To access methods in the Pet class you must first have created a Pet object Using a static method: public class Pet { private String animal; private int numpaws; public Pet(String a) {animal=a; public static void says (String c) {System.out.println(c); // this method is now static public class MakePet { public static void main (String args[]){ Pet.says( meow ); // called from the class, not an object STATIC methods can be accessed by referencing the CLASS, not an OBJECT of the class Observation # 1 : The ability to use methods of a class without having to first create an object.
9 Using a static variable: public class Pet { private String animal; private static int numpaws;... public class MakePet { public static void main (String args[]){ Pet.numPaws = 4; // 4 paws Pet bird = new Pet ( bird ); // 4 paws bird.numpaws = 2; System.out.println(Pet.numPaws); // 2 Observation # 2 : When a static variable is set, it is set (or reset) for all occurrences of the class. Static Methods & Variables used to-date: main public static void main... Math.random() int rnum=math.random() * 5; Math.PI() double pi = Math.PI(); Arrays.sort Arrays.sort(aName,0,indx); Static relationships: Static methods can only reference other static methods and static variables Non-static methods can reference either static or non-static methods and variables Static variables can be constants: public static final double PI= ;
10 Date : 1/16/2018 Aim : Wrapper Classes, File Input & Output (Lessons 21-25) Wrapper Classes: Boxing primitive data types into objects; Unboxing them from objects File I/O: Reading from / writing to data files Wrapper Classes: Primitive data types are not objects; they do not belong to any class Wraps a data type and gives it an object appearance Two main uses: 1. Convert simple data types into objects for when an object is needed 2. Convert (parse) Strings into data types Examples: Primitive Data Types Wrapper Classes String s = 100 ; int i = 8; double d1=10.0, d2=5.0; int Integer Integer.parseInt(s); Integer.toHexString(i); double Double Double.sum(d1, d2); Double.toString(d); boolean Boolean Boolean.parseBoolean(s); Click below for more information and methods: Integer Double Boolean
11 File Input & Output: Reading files from a disk, flash drive, etc. Reading files from the Internet Writing files to a disk, flash drive, etc. File Input: File Output: import java.io.*; import java.util.*; // for File, IOException // for Scanner public class FileTester { public static void main(string args[]) throws IOException { Scanner sf = new Scanner(new File("C:\\data.txt")); int indx = -1; String text[] = new String[100]; while(sf.hasnext()) { indx++; text[indx] = sf.nextline() ; sf.close(); import java.io.*; // for File, IOException public class WriteToFile { public static void main(string args[]) throws IOException { FileWriter fw = new FileWriter( C:\\Output1.txt,true); // add true to append to a file // leave it off to create a new file PrintWriter output = new PrintWriter(fw); output.print ( Four-score and ); output.println (7); output.println ( years ago. ); output.close( ); // close is very important. Data isn t fw.close( ); // accessible until files are closed. Finding a File s Path (in Windows): File Explorer > Navigate to the folder with the file > Click in the address bar > Copy the path > Paste the path in your code, in quotes > Type the filename after the path
12 Formatting Examples: To space Strings within a set number of characters, and left or right justify: String stringinfo = hello ; System.out.println(String.format("%-10s", stringinfo)); // %- left justify, % right justify // 10s allow 10 spaces for the string To format doubles to 1 decimal place: import java.text.decimalformat; // import format library DecimalFormat df=new DecimalFormat(".#"); // new DecimalFormat object double num = 99.5; // number with data type double System.out.println(df.format(num)); // print using DecimalFormat object
An exception is simply an error. Instead of saying an error occurred, we say that an.
3-1 An exception is simply an error. Instead of saying an error occurred, we say that an. Suppose we have a chain of methods. The method is the first in the chain. An expression in it calls some other
More informationAP Computer Science Chapter 10 Implementing and Using Classes Study Guide
AP Computer Science Chapter 10 Implementing and Using Classes Study Guide 1. A class that uses a given class X is called a client of X. 2. Private features of a class can be directly accessed only within
More informationJava Input/Output. 11 April 2013 OSU CSE 1
Java Input/Output 11 April 2013 OSU CSE 1 Overview The Java I/O (Input/Output) package java.io contains a group of interfaces and classes similar to the OSU CSE components SimpleReader and SimpleWriter
More informationSimple Java Reference
Simple Java Reference This document provides a reference to all the Java syntax used in the Computational Methods course. 1 Compiling and running... 2 2 The main() method... 3 3 Primitive variable types...
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationAP Computer Science A
AP Computer Science A 1st Quarter Notes Table of Contents - section links Click on the date or topic below to jump to that section Date : 9/8/2017 Aim : Java Basics Objects and Classes Data types: Primitive
More informationJava Module Lesson 2A Practice Exercise
Java Module Lesson 2A Practice Exercise Name Completion Complete each sentence or statement. 1. The three main data types used in a typical Java program are:,, and. 2. In general, data types that are simple
More informationCSC Java Programming, Fall Java Data Types and Control Constructs
CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference
More informationInput from Files. Buffered Reader
Input from Files Buffered Reader Input from files is always text. You can convert it to ints using Integer.parseInt() We use BufferedReaders to minimize the number of reads to the file. The Buffer reads
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 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 informationClasses Basic Overview
Final Review!!! Classes and Objects Program Statements (Arithmetic Operations) Program Flow String In-depth java.io (Input/Output) java.util (Utilities) Exceptions Classes Basic Overview A class is a container
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 informationCOMP Computer Basics. Yi Hong May 13, 2015
COMP 110-001 Computer Basics Yi Hong May 13, 2015 Today Hardware and memory Programs and compiling Your first program 2 Before Programming Need to know basics of a computer Understand what your program
More informationJava Intro 3. Java Intro 3. Class Libraries and the Java API. Outline
Java Intro 3 9/7/2007 1 Java Intro 3 Outline Java API Packages Access Rules, Class Visibility Strings as Objects Wrapper classes Static Attributes & Methods Hello World details 9/7/2007 2 Class Libraries
More informationMethod OverLoading printf method Arrays Declaring and Using Arrays Arrays of Objects Array as Parameters
Outline Method OverLoading printf method Arrays Declaring and Using Arrays Arrays of Objects Array as Parameters Variable Length Parameter Lists split() Method from String Class Integer & Double Wrapper
More informationAgenda & Reading. Python Vs Java. COMPSCI 230 S Software Construction
COMPSCI 230 S2 2016 Software Construction File Input/Output 2 Agenda & Reading Agenda: Introduction Byte Streams FileInputStream & FileOutputStream BufferedInputStream & BufferedOutputStream Character
More informationBinghamton 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 informationCode Listing H-1. (Car.java) H-2 Appendix H Packages
APPENDIX H Packages NOTE: To use this appendix you must understand how your operating system uses directories, or folders. In addition, you must know how to set the value of an environment variable. The
More informationI/O in Java I/O streams vs. Reader/Writer. HW#3 due today Reading Assignment: Java tutorial on Basic I/O
I/O 10-7-2013 I/O in Java I/O streams vs. Reader/Writer HW#3 due today Reading Assignment: Java tutorial on Basic I/O public class Swimmer implements Cloneable { public Date geteventdate() { return (Date)
More informationFormatting Output & Enumerated Types & Wrapper Classes
Formatting Output & Enumerated Types & Wrapper Classes Quick review of last lecture September 8, 2006 ComS 207: Programming I (in Java) Iowa State University, FALL 2006 Instructor: Alexander Stoytchev
More informationWeiss Chapter 1 terminology (parenthesized numbers are page numbers)
Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement
More informationMultiple Choice Using Object Methods
Multiple Choice Using Object Methods 01. Consider the following statement: Blank is a computer science tool that involves using program features without knowledge of how the program features are implemented.
More informationLanguage Features. 1. The primitive types int, double, and boolean are part of the AP
Language Features 1. The primitive types int, double, and boolean are part of the AP short, long, byte, char, and float are not in the subset. In particular, students need not be aware that strings are
More informationData Representation Classes, and the Java API
Data Representation Classes, and the Java API CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: http://www.csc.villanova.edu/~map/1051/
More informationA foundation for programming. Classes and objects. Overview. Java primitive types. Primitive types Creating your own data types
Classes and objects A foundation for programming any program you might want to write objects functions and modules build even bigger programs and reuse code http://www.flickr.com/photos/vermegrigio/5923415248/
More informationAP Computer Science Unit 1. Programs
AP Computer Science Unit 1. Programs Open DrJava. Under the File menu click on New Java Class and the window to the right should appear. Fill in the information as shown and click OK. This code is generated
More informationAssignment 1 due Monday at 11:59pm
Assignment 1 due Monday at 11:59pm The heart of Object-Oriented Programming (Now it gets interesting!) Reading for next lecture is Ch. 7 Focus on 7.1, 7.2, and 7.6 Read the rest of Ch. 7 for class after
More informationOutline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail.
OOP in Java 1 Outline 1. Getting started, primitive data types and control structures 2. Classes and objects 3. Extending classes 4. Using some standard packages 5. OOP revisited Parts 1 to 3 introduce
More informationWhat did we talk about last time? Examples switch statements
Week 4 - Friday What did we talk about last time? Examples switch statements History of computers Hardware Software development Basic Java syntax Output with System.out.print() Mechanical Calculation
More informationTOPICS TO COVER:-- Array declaration and use.
ARRAYS in JAVA TOPICS TO COVER:-- Array declaration and use. One-Dimensional Arrays. Passing arrays and array elements as parameters Arrays of objects Searching an array Sorting elements in an array ARRAYS
More informationChap. 3. Creating Objects The String class Java Class Library (Packages) Math.random() Reading for this Lecture: L&L,
Chap. 3 Creating Objects The String class Java Class Library (Packages) Math.random() Reading for this Lecture: L&L, 3.1 3.6 1 From last time: Account Declaring an Account object: Account acct1 = new Account
More informationObject-Oriented Programming in Java
CSCI/CMPE 3326 Object-Oriented Programming in Java Class, object, member field and method, final constant, format specifier, file I/O Dongchul Kim Department of Computer Science University of Texas Rio
More informationECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 5 Anatomy of a Class Outline Problem: How do I build and use a class? Need to understand constructors A few more tools to add to our toolbox Formatting
More informationTiming ListOperations
Timing ListOperations Michael Brockway November 13, 2017 These slides are to give you a quick start with timing operations in Java and with making sensible use of the command-line. Java on a command-line
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 informationLesson 3: Accepting User Input and Using Different Methods for Output
Lesson 3: Accepting User Input and Using Different Methods for Output Introduction So far, you have had an overview of the basics in Java. This document will discuss how to put some power in your program
More informationObject-Oriented Programming (OOP) Basics. CSCI 161 Introduction to Programming I
Object-Oriented Programming (OOP) Basics CSCI 161 Introduction to Programming I Overview Chapter 8 in the textbook Building Java Programs, by Reges & Stepp. Review of OOP History and Terms Discussion of
More informationComputer Science II (20082) Week 1: Review and Inheritance
Computer Science II 4003-232-08 (20082) Week 1: Review and Inheritance Richard Zanibbi Rochester Institute of Technology Review of CS-I Syntax and Semantics of Formal (e.g. Programming) Languages Syntax
More informationLecture 7. File Processing
Lecture 7 File Processing 1 Data (i.e., numbers and strings) stored in variables, arrays, and objects are temporary. They are lost when the program terminates. To permanently store the data created in
More informationComputational Expression
Computational Expression Variables, Primitive Data Types, Expressions Janyl Jumadinova 28-30 January, 2019 Janyl Jumadinova Computational Expression 28-30 January, 2019 1 / 17 Variables Variable is a name
More informationthis keyword (1). this with constructor (2). cisc3120 design and implementation of software applications I spring 2015 lecture # I.
topics: introduction to java, part 4 this references exception handling comparing objects vectors utility classes cisc3120 design and implementation of software applications I spring 2015 lecture # I.4
More informationCOMP 202 File Access. CONTENTS: I/O streams Reading and writing text files. COMP 202 File Access 1
COMP 202 File Access CONTENTS: I/O streams Reading and writing text files COMP 202 File Access 1 I/O Streams A stream is a sequence of bytes that flow from a source to a destination In a program, we read
More informationBASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I
BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment
More informationProgramming in the Large II: Objects and Classes (Part 1)
Programming in the Large II: Objects and Classes (Part 1) 188230 Advanced Computer Programming Asst. Prof. Dr. Kanda Runapongsa Saikaew (krunapon@kku.ac.th) Department of Computer Engineering Khon Kaen
More informationDocumenting, Using, and Testing Utility Classes
Documenting, Using, and Testing Utility Classes Readings: Chapter 2 of the Course Notes EECS2030: Advanced Object Oriented Programming Fall 2017 CHEN-WEI WANG Structure of Project: Packages and Classes
More informationI/O Streams. COMP 202 File Access. Standard I/O. I/O Stream Categories
CONTENTS: I/O streams COMP 202 File Access Reading and writing text files I/O Streams A stream is a sequence of bytes that flow from a source to a destination In a program, we read information from an
More informationCOMP 202 File Access. CONTENTS: I/O streams Reading and writing text files. COMP File Access 1
COMP 202 File Access CONTENTS: I/O streams Reading and writing text files COMP 202 - File Access 1 I/O Streams A stream is a sequence of bytes that flow from a source to a destination In a program, we
More informationAP CS Unit 3: Control Structures Notes
AP CS Unit 3: Control Structures Notes The if and if-else Statements. These statements are called control statements because they control whether a particular block of code is executed or not. Some texts
More informationCSC 1051 Algorithms and Data Structures I. Final Examination May 2, Name:
CSC 1051 Algorithms and Data Structures I Final Examination May 2, 2015 Name: Question Value 1 10 Score 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 20 TOTAL 100 Please answer questions in the spaces provided.
More informationJava Review. Java Program Structure // comments about the class public class MyProgram { Variables
Java Program Structure // comments about the class public class MyProgram { Java Review class header class body Comments can be placed almost anywhere This class is written in a file named: MyProgram.java
More informationThis exam is open book. Each question is worth 3 points.
This exam is open book. Each question is worth 3 points. Page 1 / 15 Page 2 / 15 Page 3 / 12 Page 4 / 18 Page 5 / 15 Page 6 / 9 Page 7 / 12 Page 8 / 6 Total / 100 (maximum is 102) 1. Are you in CS101 or
More informationBasics of Java Programming
Basics of Java Programming Lecture 2 COP 3252 Summer 2017 May 16, 2017 Components of a Java Program statements - A statement is some action or sequence of actions, given as a command in code. A statement
More informationChapter 2: Basic Elements of Java
Chapter 2: Basic Elements of Java TRUE/FALSE 1. The pair of characters // is used for single line comments. ANS: T PTS: 1 REF: 29 2. The == characters are a special symbol in Java. ANS: T PTS: 1 REF: 30
More informationIT101. File Input and Output
IT101 File Input and Output IO Streams A stream is a communication channel that a program has with the outside world. It is used to transfer data items in succession. An Input/Output (I/O) Stream represents
More informationMIDTERM REVIEW. midterminformation.htm
MIDTERM REVIEW http://pages.cpsc.ucalgary.ca/~tamj/233/exams/ midterminformation.htm 1 REMINDER Midterm Time: 7:00pm - 8:15pm on Friday, Mar 1, 2013 Location: ST 148 Cover everything up to the last lecture
More information1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8
Epic Test Review 1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4 Write a line of code that outputs the phase Hello World to the console without creating a new line character. System.out.print(
More informationCS 335 Lecture 02 Java Programming
1 CS 335 Lecture 02 Java Programming Programming in Java Define data Calculate using data Output result Java is object-oriented: Java program must: Merge data and functions into object Invoke functions
More information1. Download the JDK 6, from
1. Install the JDK 1. Download the JDK 6, from http://java.sun.com/javase/downloads/widget/jdk6.jsp. 2. Once the file is completed downloaded, execute it and accept the license agreement. 3. Select the
More informationData Structures. Data structures. Data structures. What is a data structure? Simple answer: a collection of data equipped with some operations.
Data Structures 1 Data structures What is a data structure? Simple answer: a collection of data equipped with some operations. Examples Lists Strings... 2 Data structures In this course, we will learn
More informationJava Identifiers, Data Types & Variables
Java Identifiers, Data Types & Variables 1. Java Identifiers: Identifiers are name given to a class, variable or a method. public class TestingShastra { //TestingShastra is an identifier for class char
More informationCS 251 Intermediate Programming Java I/O Streams
CS 251 Intermediate Programming Java I/O Streams Brooke Chenoweth University of New Mexico Spring 2018 Basic Input/Output I/O Streams mostly in java.io package File I/O mostly in java.nio.file package
More informationCSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013
CSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013 Name: This exam consists of 6 problems on the following 6 pages. You may use your two-sided hand-written 8 ½ x 11 note sheet during the exam.
More informationFall CS 101: Test 2 Name UVA ID. Grading. Page 1 / 4. Page3 / 20. Page 4 / 13. Page 5 / 10. Page 6 / 26. Page 7 / 17.
Grading Page 1 / 4 Page3 / 20 Page 4 / 13 Page 5 / 10 Page 6 / 26 Page 7 / 17 Page 8 / 10 Total / 100 1. (4 points) What is your course section? CS 101 CS 101E Pledged Page 1 of 8 Pledged The following
More informationAP Computer Science Unit 1. Writing Programs Using BlueJ
AP Computer Science Unit 1. Writing Programs Using BlueJ 1. Open up BlueJ. Click on the Project menu and select New Project. You should see the window on the right. Navigate to wherever you plan to save
More informationCLASSES AND OBJECTS. Fundamentals of Computer Science I
CLASSES AND OBJECTS Fundamentals of Computer Science I Outline Primitive types Creating your own data types Classes Objects Instance variables Instance methods Constructors Arrays of objects A Foundation
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 informationCSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI
CSCI 2010 Principles of Computer Science Data and Expressions 08/09/2013 CSCI 2010 1 Data Types, Variables and Expressions in Java We look at the primitive data types, strings and expressions that are
More informationStrings. Strings, which are widely used in Java programming, are a sequence of characters. In the Java programming language, strings are objects.
Strings Strings, which are widely used in Java programming, are a sequence of characters. In the Java programming language, strings are objects. The Java platform provides the String class to create and
More informationRecitation: Loop Jul 7, 2008
Nested Loop Recitation: Loop Jul 7, 2008 1. What is the output of the following program? Use pen and paper only. The output is: ****** ***** **** *** ** * 2. Test this program in your computer 3. Use "for
More informationAssignment 8B SOLUTIONS
CSIS 10A Assignment 8B SOLUTIONS Read: Chapter 8 Choose and complete any 10 points from the problems below, which are all included in the download file on the website. Use BlueJ to complete the assignment,
More informationCmSc 150 Fundamentals of Computing I. Lesson 28: Introduction to Classes and Objects in Java. 1. Classes and Objects
CmSc 150 Fundamentals of Computing I Lesson 28: Introduction to Classes and Objects in Java 1. Classes and Objects True object-oriented programming is based on defining classes that represent objects with
More informationCS 161: Object Oriented Problem Solving
CS 161: Object Oriented Problem Solving About this course Like 160 your first CS course - cs161 is a combination of programming and discrete math. Why is math important to us? What math have you learned
More informationHST 952. Computing for Biomedical Scientists Lecture 8
Harvard-MIT Division of Health Sciences and Technology HST.952: Computing for Biomedical Scientists HST 952 Computing for Biomedical Scientists Lecture 8 Outline Vectors Streams, Input, and Output in Java
More informationJump Statements. The keyword break and continue are often used in repetition structures to provide additional controls.
Jump Statements The keyword break and continue are often used in repetition structures to provide additional controls. break: the loop is terminated right after a break statement is executed. continue:
More informationLists using ArrayList
Lists using ArrayList 1 ArrayList One of the drawbacks of arrays is that they do not make it easy to accommodate collections of arbitrary size. We have to commit ourselves to a fixed size when we introduce
More informationCLASSES AND OBJECTS. Fundamentals of Computer Science I
CLASSES AND OBJECTS Fundamentals of Computer Science I Outline Primitive types Creating your own data types Classes Objects Instance variables Instance methods Constructors Arrays of objects A Foundation
More informationTwo hours QUESTION PAPER MUST NOT BE REMOVED FROM THE EXAM ROOM UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE
Two hours QUESTION PAPER MUST NOT BE REMOVED FROM THE EXAM ROOM UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE High-Level Programming (Java) Date: Thursday 20th January 2011 Time: 14:00-16:00 Answer
More informationCS 302 Week 9. Jim Williams
CS 302 Week 9 Jim Williams This Week P2 Milestone 3 Lab: Instantiating Classes Lecture: Wrapper Classes More Objects (Instances) and Classes Next Week: Spring Break Will this work? Double d = new Double(10);
More informationCS 231 Data Structures and Algorithms, Fall 2016
CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard
More informationAnatomy of a Class Encapsulation Anatomy of a Method
Writing Classes Writing Classes We've been using predefined classes. Now we will learn to write our own classes to define objects Chapter 4 focuses on: class definitions instance data encapsulation and
More informationChapter 4: Writing Classes
Chapter 4: Writing Classes Java Software Solutions Foundations of Program Design Sixth Edition by Lewis & Loftus Writing Classes We've been using predefined classes. Now we will learn to write our own
More informationFinal Exam Practice Questions
Final Exam Practice Questions 1. Short Answer Questions (10 points total) (a) Given the following hierarchy: class Alpha {... class Beta extends Alpha {... class Gamma extends Beta {... What order are
More informationJava API: Math, Wrapper Classes, StringBuffer Random Data Quiz2
Java API: Math, Wrapper Classes, StringBuffer Random Data Quiz2 163 Recap Lessons learned: We can generate documentation from Javadoc We can call any method in a program from any other method in that program
More information16-Dec-10. Consider the following method:
Boaz Kantor Introduction to Computer Science IDC Herzliya Exception is a class. Java comes with many, we can write our own. The Exception objects, along with some Java-specific structures, allow us to
More informationCOMP-202 Unit 9: Exceptions
COMP-202 Unit 9: Exceptions Course Evaluations Please do these. -Fast to do -Used to improve course for future. (Winter 2011 had 6 assignments reduced to 4 based on feedback!) 2 Avoiding errors So far,
More informationRemedial Java - io 8/09/16. (remedial) Java. I/O. Anastasia Bezerianos 1
(remedial) Java anastasia.bezerianos@lri.fr I/O Anastasia Bezerianos 1 Input/Output Input Output Program We ve seen output System.out.println( some string ); Anastasia Bezerianos 2 Standard input/output!
More informationCOMP 202. Built in Libraries and objects. CONTENTS: Introduction to objects Introduction to some basic Java libraries string
COMP 202 Built in Libraries and objects CONTENTS: Introduction to objects Introduction to some basic Java libraries string COMP 202 Objects and Built in Libraries 1 Classes and Objects An object is an
More informationComputer Systems. IGCSE OCR AQA Edexcel Understand the term. embedded system and how an Purpose of embedded system
This scheme gives pupils an introduction to computer systems and begins with students getting a real idea of the functions of the main hardware components by creating their own cardboard laptop. By looking
More informationClass Libraries and Packages
Class Libraries and Packages Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria Wolfgang.Schreiner@risc.jku.at http://www.risc.jku.at Wolfgang
More informationComp 248 Introduction to Programming Chapter 4 - Defining Classes Part A
Comp 248 Introduction to Programming Chapter 4 - Defining Classes Part A Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia University, Montreal, Canada These slides has been
More informationJava Tutorial. Saarland University. Ashkan Taslimi. Tutorial 3 September 6, 2011
Java Tutorial Ashkan Taslimi Saarland University Tutorial 3 September 6, 2011 1 Outline Tutorial 2 Review Access Level Modifiers Methods Selection Statements 2 Review Programming Style and Documentation
More informationChapter 1. Introduction to Computers and Programming. M hiwa ahmad aziz
. Chapter 1 Introduction to Computers and Programming www.raparinweb.com M hiwa ahmad aziz 1 Ch 1 - Introduction to Computers and Programming Hardware Terminology Main Memory Auxiliary Memory Drives Writing
More informationENGR 2710U Midterm Exam UOIT SOLUTION SHEET
SOLUTION SHEET ENGR 2710U: Object Oriented Programming & Design Midterm Exam October 19, 2012, Duration: 80 Minutes (9 Pages, 14 questions, 100 Marks) Instructor: Dr. Kamran Sartipi Name: Student Number:
More informationCSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O
CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O 1 Sending Output to a (Text) File import java.util.scanner; import java.io.*; public class TextFileOutputDemo1 public static void
More informationCheck out how to use the random number generator (introduced in section 4.11 of the text) to get a number between 1 and 6 to create the simulation.
Chapter 4 Lab Loops and Files Lab Objectives Be able to convert an algorithm using control structures into Java Be able to write a while loop Be able to write an do-while loop Be able to write a for loop
More informationPIC 20A The Basics of Java
PIC 20A The Basics of Java Ernest Ryu UCLA Mathematics Last edited: November 1, 2017 Outline Variables Control structures classes Compilation final and static modifiers Arrays Examples: String, Math, and
More informationJava Programming Language. 0 A history
Java Programming Language 0 A history How java works What you ll do in Java JVM API Java Features 0Platform Independence. 0Object Oriented. 0Compiler/Interpreter 0 Good Performance 0Robust. 0Security 0
More informationTirgul 1. Course Guidelines. Packages. Special requests. Inner classes. Inner classes - Example & Syntax
Tirgul 1 Today s topics: Course s details and guidelines. Java reminders and additions: Packages Inner classes Command Line rguments Primitive and Reference Data Types Guidelines and overview of exercise
More informationCSC 222: Object-Oriented Programming. Fall Object-oriented design
CSC 222: Object-Oriented Programming Fall 2015 Object-oriented design example: word frequencies w/ parallel lists exception handling System.out.format example: word frequencies w/ objects object-oriented
More information