Java for Beginners University Greenwich Computing At School DASCO

Slides:



Advertisements
Similar presentations
STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
Advertisements

Computer Science 209 Software Development Equality and Comparisons.
CS324e - Elements of Graphics and Visualization A Little Java A Little Python.
Loops Notes adapted from Dr. Flores. It repeats a set of statements while a condition is true. while (condition) { execute these statements; } “while”
CSE373 Optional Section Java Collections 11/12/2013 Luyi Lu.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Summary and Exam COMP 102.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 62 – Manipulating Data Using Methods – Day 1.
Java for Beginners University Greenwich Computing At School DASCO
6 Stack ADTs  Stack concepts  Stack applications  Stack ADTs: requirements, contracts  Implementations of stacks: using arrays and linked-lists  Stacks.
BUILDING JAVA PROGRAMS CHAPTER 7 Arrays. Exam #2: Chapters 1-6 Thursday Dec. 4th.
Computer Programming 12 Mr. Jean April 24, The plan: Video clip of the day Upcoming Quiz Sample arrays Using arrays More about arrays.
End of unit assessment Challenge 1 & 2. Course summary So far in this course you have learnt about and used: Syntax Output to screen (PRINT) Variables.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
2016 N5 Prelim Revision. HTML Absolute/Relative addressing in HTML.
The ArrayList Data Structure Standard Arrays at High Speed! More Safety, More Efficient, and Less Overhead!
1ADS Lecture 11 Stacks contd.. ADS Lecture 113 Singly Linked list-based Stack Top of stack is head of list (can insert elements at head in constant.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Summary and Exam COMP 102.
Algorithms and Computer Programming. Algorithms algorithm is an ordered sequence of instructions for solving a problem. Look at it as a building blocks.
Simple “VICO” (“VIPO”) Programs (Variables, Input, Calculating or Processing, Output)
Midterm Review Tami Meredith. Primitive Data Types byte, short, int, long Values without a decimal point,..., -1, 0, 1, 2,... float, double Values with.
In C programming, one of the frequently arising problem is to handle similar types of data. For example: If the user want to store marks of 100 students.
Computer Eng. Software Lab II , Semester 2, Who I am: Andrew Davison CoE, WiG Lab Office Functional Programming.
Chapter 9 Introduction to Arrays Fundamentals of Java.
Java for Beginners University Greenwich Computing At School DASCO
Using the Java Collection Libraries COMP 103 # T2
Andrew(amwallis) Classes!
Some Assignments  Write a program which prints the following information about at least 5 persons: NAME MAIL-ID EMPLOYEE-CODE PHONE Eg. Umesh
Pseudocode Key Revision Points.
Java for Beginners University Greenwich Computing At School DASCO
Java for Beginners Level 6 University Greenwich Computing At School
Java for Beginners University Greenwich Computing At School DASCO
(like an array on steroids)
Fundamentals of Java: AP Computer Science Essentials, 4th Edition
Foundations of Programming: Arrays
Java for Beginners University Greenwich Computing At School DASCO
Chapter 7 Part 1 Edited by JJ Shepherd
Java for Beginners.
Switch, Rounding Errors, Libraries
An Introduction to Java – Part I
Hash table another data structure for implementing a map or a set
CS 106A, Lecture 19 ArrayLists
Arrays An Array is an ordered collection of variables
Java for Beginners University Greenwich Computing At School DASCO
Java for Teachers Intermediate
An Introduction to Java – Part I, language basics
Words exercise Write code to read a file and display its words in reverse order. A solution that uses an array: String[] allWords = new String[1000]; int.
Building Java Programs
Arrays .
Welcome to CSE 143! Go to pollev.com/cse143.
Can we solve this problem?
int [] scores = new int [10];
Collections Framework
CS150 Introduction to Computer Science 1
Review for Test1.
Introduction to Data Structure
Java for Beginners University Greenwich Computing At School DASCO
Functions continued.
Can we solve this problem?
Computing Spans Given an an array X, the span S[i] of X[i] is
CS2013 Lecture 7 John Hurley Cal State LA.
Review: libraries and packages
Java: Variables, Input and Arrays
Why are arrays useful? We can use arrays to store a large amount of data without declaring many variables. Example: Read in a file of 1000 numbers, then.
Can we solve this problem?
Consider Write a program that prompts a user to enter the number of students and then, their names and grades. The program will then outputs the average.
Input, Variables, and Mathematical Expressions
Data Structures and Algorithms 2/2561
Java Coding 6 David Davenport Computer Eng. Dept.,
COMPUTING.
Week 7 - Monday CS 121.
Presentation transcript:

Java for Beginners University Greenwich Computing At School DASCO Chris Coetzee

Levels of Java coding 1: Syntax, laws, variables, output 2: Input, calculations, String manipulation 3: Selection (IF-ELSE) 4: Iteration/Loops (FOR/WHILE) 5: Complex algorithms 6: Arrays/Linked Lists 7: File management 8: Methods 9: Objects and classes 10: Graphical user interface elements

Arrays vs Linked Lists Array List Size can change Fixed size One or Two dimensions Array Size can change Only linear List

Before you using a Linked List… Remember to import the utility libraries! import java.util.*;

Warning: don’t use double, int, char or boolean Creating a Linked List Warning: don’t use double, int, char or boolean Remember the () at the end!

Adding items to a linked list Output

Removing items from a linked list Output

Useful LinkedList methods What does it do .add(xx) Adds xx onto the end of the linked list .remove(y) Removes the element at position y .size() Returns how many elements there are in the linked list .indexOf(xx) Returns what element xx is stored in; returns -1 if element was not found

Beware getting the size! .size()  Linked Lists e.g. int k = zones.size(); //zones is a linked list .length()  Strings e.g. int m = name.length(); //name is a String .length  arrays e.g. int g = boxes.length; //boxes is an array

What did the programmer forget to do…? LinkedList example What did the programmer forget to do…?