Lecture 4. A Real Java Program!! Generic Program Template. You first Java programs. Program design guidelines. Examples.
|
|
- Berniece McKenzie
- 6 years ago
- Views:
Transcription
1 Lecture 4 A Real Java Program!! // program to demonstrate the use of the String class methods class Ex_2 { You first Java programs. Program design guidelines. Examples. Material from Holmes Chapter 2. 1 public static void main(string[] args) throws IOException { // declarations String word, part; // instructions System.out.print("Type in the given string please: "); word = new String( keyboard.readline() ); part = word.substring(0,1); part = part.touppercase(); System.out.print("So the word is " + part.concat(word.substring(1,word.length()))); 11 Generic Program Template Comments on Holmes pp // Comments on what the program does class Dummy { BufferedReader ( new InputStreamReader ( System.in ) ); public static void main (String[] args) throws IOException { // declarations // instructions // chap_2\ex_3.java // program to calculate the circumference and // area of a circle class Ex_3 { BufferedReader(new InputStreamReader(System.in)); public static void main(string[] args) throws IOException { // data declarations float radius, circumference, area; // prompt and input radius System.out.print("Input radius "); System.out.flush(); radius = new Float(keyboard.readLine()).floatValue(); // calculate circumference and area circumference = 2.0f * (float) Math.PI * radius; area = (float) Math.PI * radius * radius;
2 // display statistics of circle System.out.println("Statistics of Circle\n"); System.out.println("Radius " + radius); System.out.println("Circumference " + circumference); System.out.println("Area " + area); Playtime 1. Write a program that computes the area of a regular polygon, given its apothem and the number of sides. Playtime 2. (Harder) Write a program that computes the area of a regular polygon, given its radius and the number of sides. Program Implementation Editor Compiler Interpreter text Results Data A Data Flow Diagram (DFD) for the implementation process import java.i0.*; Regular Polygons triangle square pentagon exagon eptagon the radius of a polygon is the segment from the centre of the polygon to one of its vertices. the apothem of a polygon is the segment from the centre of the polygon to the middle point of any of its sides. class LessSimple { // global declarations public static void main (String[] args) throws IOException { // declarations int A; ont b; int c; // instructions System.out.print("Input the first integer number: "); a = new Integer( keyboard.readline() ).intvalue(); System.out.print("Input the second integer number: "); b = new Integer( keyboard.readline() ).intvalue(); c = a + b System.out.println("The result of adding " + a + " and " b + " is the number " + c);
3 simplest2]$ javac LessSimple.java LessSimple.java:20: ; expected c = a + b LessSimple.java:1: package java.i0 does not exist import java.i0.*; LessSimple.java:5: cannot resolve symbol symbol : class BufferedReader LessSimple.java:8: cannot resolve symbol symbol : class IOException public static void main (String[] args) throws IOException { LessSimple.java:6: cannot resolve symbol symbol : class BufferedReader LessSimple.java:6: cannot resolve symbol symbol : class InputStreamReader 18-2 Software Development Unless you re familiar with programming already, probably the most popular question that comes to your mind at this stage is: How am I going to do it? No panic! This is one of the major skills in our job and there are methods to learn it. 19 LessSimple.java:12: cannot resolve symbol symbol : class ont ont b; LessSimple.java:17: cannot resolve symbol symbol : variable a a = new Integer( keyboard.readline() ).intvalue(); LessSimple.java:20: cannot resolve symbol symbol : variable a c = a + b 9 errors Program Design Problem analysis. Studying the nature of the problem. Algorithm. (This is the creative step) Invent a way to solve it. Data Dictionary. List the data you need. Desk Check. Using traces, check the correctness of your program. Screen Layout. Decide how the output should look. Coding. Type in your program. Test results. After successful compilation, check that you get correct results. Let s look at a couple of examples
4 Case Study: Time Taken to Fill a Swimming Pool Problem. Write a program to input the length, width and depth of a rectangular swimming pool of uniform depth and calculate the time it takes to fill it. Assume the rate of flow of water into the pool is 50 liters per minutes and that 1 cube meter has a capacity of 1,000 liters of water. Problem Analysis. The solution involves computing the volume of the swimming pool (in cube meters) and multiply it by 1,000 to obtain the capacity of the pool. The time taken to fill that up is then computed by dividing the total capacity by the rate of flow. We can refine each of the steps (this is called stepwise refinement): 1. input the size of the pool (a) input length (b) input width (c) input depth 2. calculate the volume of the pool (a) volume = length width depth. 3. calculate the time to fill the pool (a) capacity = volume capacity per cube meter. (b) time = capacity rate of flow. 4. output the results (a) output the volume of the pool (b) output the capacity of the water in liters (c) output the time to fill the pool Data Dictionary. Decide what variables to use and of which type. Algorithm. Quite straightforward. At a high level of abstraction. 1. input the size of the pool 2. calculate the volume of the pool 3. calculate the time to fill the pool 4. output the results // rate of water flow into pool is 50 liters per minute final float RATE_OF_FLOW = 50.0f; // cubic meter of water has a capacity of 1,000 liters! final float CAPACITY = f; float lengthofpool; float widthofpool; float depthofpool; float volumeofpool; float capacityofpool; float timetofillpool; 22 23
5 // chap_2\ex_4.java // program to calculate the time to fill a swimming pool class Ex_4 { BufferedReader(new InputStreamReader(System.in)); public static void main(string[] args) throws IOException { // rate of water flow into pool is 50 liters per minute final float RATE_OF_FLOW = 50.0f; // One cubic meter of water has a capacity of 1,000 liters! final float CAPACITY = f; float lengthofpool, widthofpool, depthofpool; float volumeofpool, capacityofpool, timetofillpool; // input size of pool System.out.println("Input dimensions of Swimming Pool\n"); System.out.print("Length? "); System.out.flush(); lengthofpool = new Float(keyboard.readLine()).floatValue(); System.out.print("Width? "); System.out.flush(); widthofpool = new Float(keyboard.readLine()).floatValue(); System.out.print("Depth? "); System.out.flush(); 23-1 Case Study: Average Price of Fuel Consumption Problem. Write a program to input the cost of fuel put in the car each day of the week, then compute the total cost and the average cost (in pounds), and display the results of the two computations. Problem Analysis. The input stage need to present the user with the days of the week and wait for the user to input the appropriate amount of money. Then the total cost of the fuel is simply the sum of seven different costs and the average is the total cost divided by seven. 24 depthofpool = new Float(keyboard.readLine()).floatValue(); // calculations volumeofpool = lengthofpool * widthofpool * depthofpool; capacityofpool = volumeofpool * CAPACITY; timetofillpool = capacityofpool / (RATE_OF_FLOW * 60); // display information System.out.println("\nStatistics of Swimming Pool\n"); System.out.println("Volume \t" + volumeofpool + " cubic meters"); System.out.println("Capacity \t" + capacityofpool + " liters"); System.out.println("Filling time\t" + timetofillpool + " hours"); Algorithm. 1. input data for fuel cost (a) input Monday s cost (b) input Tuesday s cost (c) input Wednesday s cost (d) input Thursday s cost (e) input Friday s cost (f) input Saturday s cost (g) input Sunday s cost 2. calculate costs (a) calculate total cost by summing the daily costs; (b) calculate the average cost by dividing the total by seven. 3. output results (a) display total cost (b) display average cost
6 // the computation totalcost = MondayCost + TuesdayCost + WednesCost + ThursCost + FridayCost + SaturdayCost + SundayCost; avgcost = totalcost / 3; Data Dictionary The seven days of the week can be displayed on the screen when asking for the data. We need seven variables for the fuel cost in each day and two more variables one for the total and the other for the average cost: // the output section System.out.println("\nStatistics about fuel costs\n"); System.out.println("Total price " + totalcost + " pounds"); System.out.println("Average price " + avgcost + " pounds"); double MondayCost, TuesdayCost, WednesCost, ThursdayCost, FridayCost, SaturdayCost, SundayCost; double totalcost, avgcost; // chap_2\ex_5.java // program to input the cost of fuel each day of the week, // calculate and display the total cost of the fuel and the // average price (per day) class Ex_5 { BufferedReader(new InputStreamReader(System.in)); public static void main(string[] args) { double MondayCost, TuesdayCost, WednesCost, ThursCost, FridayCost, SaturdayCost, SundayCost; double totalcost, avgcost; // the input section System.out.println("Input data on fuel prices\n"); System.out.print("How much did you spend on Monday? ") System.out.flush( MondayCost = new Double(keyboard.readLine()).doubleValue(); System.out.print("And on Tuesday? "); System.out.flush(); TuesdayCost = new Double(keyboard.readLine()).doubleValue();... Tutorial. Type in, compile and run all the programs we have looked at and convince yourself that they work. Important! This is the way any programming assignment should be solved! Your submission should include all ingredients we have seen in these examples: problem statement, analysis, algorithmic solution, data dictionary and code, plus a number of tests to check that the program works
Lecture 6. Drinking. Nested if. Nested if s reprise. The boolean data type. More complex selection statements: switch. Examples.
// Simple program to show how an if- statement works. import java.io.*; Lecture 6 class If { static BufferedReader keyboard = new BufferedReader ( new InputStreamReader( System.in)); public static void
More informationLab 9: Creating a Reusable Class
Lab 9: Creating a Reusable Class Objective This will introduce the student to creating custom, reusable classes This will introduce the student to using the custom, reusable class This will reinforce programming
More informationCase Study: Savings Account Interest
ecture 8 Loops: recap + example. Files: abstracting from a specific devise. Streams and Tokens. Examples. Material from the second half of Holmes Chapter 4. 1 w do you add up a sequence of numbers? = 1;
More informationData Types and the while Statement
Session 2 Student Name Other Identification Data Types and the while Statement In this laboratory you will: 1. Learn about three of the primitive data types in Java, int, double, char. 2. Learn about the
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 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 informationoblem. The annual rainfall is recorded monthly over four regions calculate the total and average rainfall for a region one needs to sum up
ecture 10 More examples with (multi-dimensional) arrays. Vectors (variable size sequences). Material from the second half of Holmes Chapter 5 (with few bits missing). 1 ase Study: Calculate Rainfall over
More informationIntroducing arrays. Week 4: arrays and strings. Creating arrays. Declaring arrays. Initialising arrays. Declaring and creating in one step
School of Computer Science, University of Birmingham Java Lecture notes. M. D. Ryan. September 2001. Introducing arrays Week 4: arrays and strings Arrays: a data structure used to store multiple data,
More informationExercise 4: Loops, Arrays and Files
Exercise 4: Loops, Arrays and Files worth 24% of the final mark November 4, 2004 Instructions Submit your programs in a floppy disk. Deliver the disk to Michele Zito at the 12noon lecture on Tuesday November
More informationComputer Programming, I. Laboratory Manual. Experiment #2. Elementary Programming
Think Twice Code Once The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2005 Khaleel I. Shaheen Computer Programming, I Laboratory Manual Experiment #2
More informationFull file at Chapter 2 - Inheritance and Exception Handling
Chapter 2 - Inheritance and Exception Handling TRUE/FALSE 1. The superclass inherits all its properties from the subclass. ANS: F PTS: 1 REF: 76 2. Private members of a superclass can be accessed by a
More informationAttendance Questions: Find the area of each shape. Round your answer to the nearest tenth. 1. An equilateral triangle with edge length 20 cm.
Page 1 of 17 Attendance Questions: Find the area of each shape. Round your answer to the nearest tenth. 1. An equilateral triangle with edge length 20 cm. Page 1 of 17 Page 2 of 17 2. A regular hexagon
More informationCOMP101: Introduction to Programming in JAVA. Reading: Morelli Chapter 0, Chapter 2, Chapter 3, Cohoon and Davidson Chapter 1. For pseudocode see
Lecture 10 Algorithm Design COMP101: Introduction to Programming in JAVA Reading: Morelli Chapter 0, Chapter 2, Chapter 3, Cohoon and Davidson Chapter 1. For pseudocode see users.csc.calpoly.edu/ jdalbey/swe/pdl_std.html
More informationAlgorithms and Problem Solving
Algorithms and Problem Solving Introduction What is an Algorithm? Algorithm Properties Example Exercises Unit 16 1 What is an Algorithm? What is an Algorithm? An algorithm is a precisely defined and ordered
More informationVisual Basic for Applications
Visual Basic for Applications Programming Damiano SOMENZI School of Economics and Management Advanced Computer Skills damiano.somenzi@unibz.it Week 1 Outline 1 Visual Basic for Applications Programming
More informationLecture 11. Example 1. Introduction. Method definition and invocation. Parameter passing: value vs. reference parameters. Scope and Lifetime.
Lecture 11 Example 1 Method definition and invocation. Parameter passing: value vs. reference parameters. Scope and Lifetime. Constructors Material from Holmes Chapter 6: sections 1 through to 8, except
More informationA very simple program. Week 2: variables & expressions. Declaring variables. Assignments: examples. Initialising variables. Assignments: pattern
School of Computer Science, University of Birmingham. Java Lecture notes. M. D. Ryan. September 2001. A very simple program Week 2: variables & expressions Variables, assignments, expressions, and types.
More information/ Download the Khateeb Classes App
Q) Write a program to read and display the information about a book using the following relationship. Solution: import java.io.*; class Author String name,nationality,s; InputStreamReader r = new InputStreamReader(System.in);
More informationBjarne Stroustrup. creator of C++
We Continue GEEN163 I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone. Bjarne Stroustrup creator
More informationByte and Character Streams. Reading and Writing Console input and output
Byte and Character Streams Reading and Writing Console input and output 1 I/O basics The io package supports Java s basic I/O (input/output) Java does provide strong, flexible support for I/O as it relates
More informationUsing Variables to Write Pattern Rules
Using Variables to Write Pattern Rules Goal Use numbers and variables to represent mathematical relationships. 1. a) What stays the same and what changes in the pattern below? b) Describe the pattern rule
More information11.4 Volume of Prisms and Cylinders
11.4 Volume of Prisms and Cylinders Learning Objectives Find the volume of a prism. Find the volume of a cylinder. Review Queue 1. Define volume in your own words. 2. What is the surface area of a cube
More informationTools : The Java Compiler. The Java Interpreter. The Java Debugger
Tools : The Java Compiler javac [ options ] filename.java... -depend: Causes recompilation of class files on which the source files given as command line arguments recursively depend. -O: Optimizes code,
More informationCSEN 202 Introduction to Computer Programming
CSEN 202 Introduction to Computer Programming Lecture 4: Iterations Prof. Dr. Slim Abdennadher and Dr Mohammed Abdel Megeed Salem, slim.abdennadher@guc.edu.eg German University Cairo, Department of Media
More informationCOMP-202: Foundations of Programming. Lecture 8: for Loops, Nested Loops and Arrays Jackie Cheung, Winter 2016
COMP-202: Foundations of Programming Lecture 8: for Loops, Nested Loops and Arrays Jackie Cheung, Winter 2016 Review What is the difference between a while loop and an if statement? What is an off-by-one
More information9 Find the area of the figure. Round to the. 11 Find the area of the figure. Round to the
Name: Period: Date: Show all work for full credit. Provide exact answers and decimal (rounded to nearest tenth, unless instructed differently). Ch 11 Retake Test Review 1 Find the area of a regular octagon
More informationLecture 11.1 I/O Streams
21/04/2014 Ebtsam AbdelHakam 1 OBJECT ORIENTED PROGRAMMING Lecture 11.1 I/O Streams 21/04/2014 Ebtsam AbdelHakam 2 Outline I/O Basics Streams Reading characters and string 21/04/2014 Ebtsam AbdelHakam
More informationMaths Programme of Study 3.3
1 4/9/17 2 11/9/17 3 18/9/17 4 25/9/17 5 2/10/17 Recognise place value of each digit in 4-digit numbers. Identify, estimate and represent numbers using different representations including measures. Compare
More information12.4 Volume of Prisms, Cylinders, Pyramids, and Cones. Geometry Mr. Peebles Spring 2013
12.4 Volume of Prisms, Cylinders, Pyramids, and Cones Geometry Mr. Peebles Spring 2013 Geometry Bell Ringer Find the volume of the cylinder with a radius of 7 in. and a height of 10 in. Please leave your
More informationTopic 4 Expressions and variables
Topic 4 Expressions and variables "Once a person has understood the way variables are used in programming, he has understood the quintessence of programming." -Professor Edsger W. Dijkstra Based on slides
More informationESc101 : Fundamental of Computing
ESc101 : Fundamental of Computing I Semester 2008-09 Instructor : Surender Baswana 1 Aim of the course How to solve problems by computer? Prerequisites : elementary knowledge of mathematics (high school).
More informationBuilding Java Programs
Building Java Programs Chapter 3: Parameters, Return, and Interactive Programs with Scanner 1 Lecture outline console input with Scanner objects input tokens Scanner as a parameter to a method cumulative
More informationRecursion. General Algorithm for Recursion. When to use and not use Recursion. Recursion Removal. Examples
Recursion General Algorithm for Recursion When to use and not use Recursion Recursion Removal Examples Comparison of the Iterative and Recursive Solutions Exercises Unit 19 1 General Algorithm for Recursion
More informationChapter 2. Elementary Programming
Chapter 2 Elementary Programming 1 Objectives To write Java programs to perform simple calculations To obtain input from the console using the Scanner class To use identifiers to name variables, constants,
More informationFirst Programs. CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington
First Programs CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1 Output System.out.println( ) prints out something. System.out.println is the first
More informationCS 113 PRACTICE FINAL
CS 113 PRACTICE FINAL There are 13 questions on this test. The value of each question is: 1-10 multiple choice (4 pt) 11-13 coding problems (20 pt) You may get partial credit for questions 11-13. If you
More informationPAF Chapter Prep Section Mathematics Class 6 Worksheets for Intervention Classes
The City School PAF Chapter Prep Section Mathematics Class 6 Worksheets for Intervention Classes Topic: Percentage Q1. Convert it into fractions and its lowest term: a) 25% b) 75% c) 37% Q2. Convert the
More informationUNIT 3 CIRCLES AND VOLUME Lesson 5: Explaining and Applying Area and Volume Formulas Instruction
Prerequisite Skills This lesson requires the use of the following skills: understanding and using formulas for the volume of prisms, cylinders, pyramids, and cones understanding and applying the formula
More informationJava: Classes. An instance of a class is an object based on the class. Creation of an instance from a class is called instantiation.
Java: Classes Introduction A class defines the abstract characteristics of a thing (object), including its attributes and what it can do. Every Java program is composed of at least one class. From a programming
More information12.4 Volume of Prisms, Cylinders, Pyramids, and Cones. Geometry Mr. Peebles Spring 2013
12.4 Volume of Prisms, Cylinders, Pyramids, and Cones Geometry Mr. Peebles Spring 2013 Geometry Bell Ringer Geometry Bell Ringer Answer: B Daily Learning Target (DLT) Wednesday January 30, 2013 I can understand,
More informationAQA Decision 1 Algorithms. Section 1: Communicating an algorithm
AQA Decision 1 Algorithms Section 1: Communicating an algorithm Notes and Examples These notes contain subsections on Flow charts Pseudo code Loops in algorithms Programs for the TI-83 graphical calculator
More informationUnit 11 Three Dimensional Geometry
Unit 11 Three Dimensional Geometry Day Classwork Day Homework Monday 2/12 Tuesday 2/13 Wednesday 2/14 Areas of Regular Polygons 1 HW 11.1 Volume of Prisms & Cylinders 2 HW 11.4 Volume of Pyramids and Cones
More informationObjectives. Describe ways to create constants const readonly enum
Constants Objectives Describe ways to create constants const readonly enum 2 Motivation Idea of constant is useful makes programs more readable allows more compile time error checking 3 Const Keyword const
More informationCOMP-202: Foundations of Programming. Lecture 4: Flow Control Loops Sandeep Manjanna, Summer 2015
COMP-202: Foundations of Programming Lecture 4: Flow Control Loops Sandeep Manjanna, Summer 2015 Announcements Check the calendar on the course webpage regularly for updates on tutorials and office hours.
More information/ Download the Khateeb Classes App
Q) Write a program to read and display an array on screen. class Data public static void main(string args[ ]) throws IOException int i,n; InputStreamReader r = new InputStreamReader(System.in); BufferedReader
More informationYear 6 Maths Long Term Plan
Week & Focus 1 Number and Place Value Unit 1 2 Subtraction Value Unit 1 3 Subtraction Unit 3 4 Subtraction Unit 5 5 Unit 2 6 Division Unit 4 7 Fractions Unit 2 Autumn Term Objectives read, write, order
More informationFirst Programs. CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington
First Programs CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1 Output System.out.println( ) prints out something. System.out.println is the first
More informationGrade 8 Common Mathematics Assessment Multiple Choice Answer Sheet Name: Mathematics Teacher: Homeroom: Section A No Calculator Permitted
Multiple Choice Answer Sheet Name: Mathematics Teacher: Homeroom: Section A No Calculator Permitted Calculator Permitted. A B C D 2. A B C D. A B C D 4. A B C D 5. A B C D 6. A B C D 7. A B C D 8. A B
More informationTopics. Java arrays. Definition. Data Structures and Information Systems Part 1: Data Structures. Lecture 3: Arrays (1)
Topics Data Structures and Information Systems Part 1: Data Structures Michele Zito Lecture 3: Arrays (1) Data structure definition: arrays. Java arrays creation access Primitive types and reference types
More informationFirst Programs. CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington
First Programs CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1 Output System.out.println( ) prints out something. System.out.println is the first
More informationCS 11 java track: lecture 1
CS 11 java track: lecture 1 Administrivia need a CS cluster account http://www.cs.caltech.edu/ cgi-bin/sysadmin/account_request.cgi need to know UNIX www.its.caltech.edu/its/facilities/labsclusters/ unix/unixtutorial.shtml
More informationObjectives/Outcomes. Introduction: If we have a set "collection" of fruits : Banana, Apple and Grapes.
1 September 26 September One: Sets Introduction to Sets Define a set Introduction: If we have a set "collection" of fruits : Banana, Apple Grapes. 4 F={,, } Banana is member "an element" of the set F.
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 informationA sample print out is: is is -11 key entered was: w
Lab 9 Lesson 9-2: Exercise 1, 2 and 3: Note: when you run this you may need to maximize the window. The modified buttonhandler is: private static class ButtonListener implements ActionListener public void
More informationFunctional Mathematics 4368
Centre Number Surname Candidate Number For Examiner s Use Other Names Candidate Signature Examiner s Initials Question Mark Functional Skills Certificate June 2015 Functional Mathematics 4368 Level 2 1
More informatione) Implicit and Explicit Type Conversion Pg 328 j) Types of errors Pg 371
Class IX HY 2013 Revision Guidelines Page 1 Section A (Power Point) Q1.What is PowerPoint? How are PowerPoint files named? Q2. Describe the 4 different ways of creating a presentation? (2 lines each) Q3.
More informationVolume of Prisms and Cylinders
Volume of Prisms and Cylinders Say Thanks to the Authors Click http://www.ck12.org/saythanks (No sign in required) To access a customizable version of this book, as well as other interactive content, visit
More informationYear 6 Step 1 Step 2 Step 3 End of Year Expectations Using and Applying I can solve number problems and practical problems involving a range of ideas
Year 6 Step 1 Step 2 Step 3 End of Year Expectations Using and Applying I can solve number problems and practical problems involving a range of ideas Number Number system and counting Fractions and decimals
More informationYear 6 Step 1 Step 2 Step 3 End of Year Expectations Using and Applying I can solve number problems and practical problems involving a range of ideas
Year 6 Step 1 Step 2 Step 3 End of Year Expectations Using and Applying I can solve number problems and practical problems involving a range of ideas Number Number system and counting Fractions and decimals
More informationBuilding Java Programs. Chapter 2: Primitive Data and Definite Loops
Building Java Programs Chapter 2: Primitive Data and Definite Loops Copyright 2008 2006 by Pearson Education 1 Lecture outline data concepts Primitive types: int, double, char (for now) Expressions: operators,
More informationCOMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette
COMP 250: Java Programming I Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette Variables and types [Downey Ch 2] Variable: temporary storage location in memory.
More informationArt, Nature, and Patterns Introduction
Art, Nature, and Patterns Introduction to LOGO Describing patterns with symbols This tutorial is designed to introduce you to some basic LOGO commands as well as two fundamental and powerful principles
More informationStructures and Pointers
Structures and Pointers Comp-206 : Introduction to Software Systems Lecture 11 Alexandre Denault Computer Science McGill University Fall 2006 Note on Assignment 1 Please note that handin does not allow
More informationIntroduction to Computer Programming
Introduction to Computer Programming Lecture 2- Primitive Data and Stepwise Refinement Data Types Type - A category or set of data values. Constrains the operations that can be performed on data Many languages
More informationMental Math. Grade 9 Mathematics (10F) General Questions. 2. What is the volume of a pool that measures 7 m by 3 m by 2 m? 42 m 3
E 1 Substrand: -D Objects and 2-D Shapes Specific Learning Outcome: 9.SS.2 1. What value of m satisfies the equation 5 m 1? m 4 4 5 2. What is the volume of a pool that measures 7 m by m by 2 m? 42 m.
More informationActivity 1: Introduction
Activity 1: Introduction In this course, you will work in teams of 3 4 students to learn new concepts. This activity will introduce you to the process. We ll also take a first look at how to store data
More informationMath 1 Plane Geometry Part 1
Math 1 Plane Geometry Part 1 1 Intersecting lines: When two lines intersect, adjacent angles are supplementary (they make a line and add up to 180 degrees, and vertical angles (angles across from each
More informationEnumerated Types. CSE 114, Computer Science 1 Stony Brook University
Enumerated Types CSE 114, Computer Science 1 Stony Brook University http://www.cs.stonybrook.edu/~cse114 1 Enumerated Types An enumerated type defines a list of enumerated values Each value is an identifier
More informationJava 11 and MAKING ECLIPSE JDT FUTURE READY MANOJ PALAT IBM
Java 11 and Beyond MAKING ECLIPSE JDT FUTURE READY MANOJ PALAT IBM @manojnp Java Releases Road Traveled++ Version 1.0 1.1,1.2,1.3,1.4,1.5,1.6 1.7 1.8 9 10 11 12 13 Release Date 1996 1997, 1998, 2000, 2002,
More informationModule - 3 Classes, Inheritance, Exceptions, Packages and Interfaces. OOC 4 th Sem, B Div Prof. Mouna M. Naravani
Module - 3 Classes, Inheritance, Exceptions, Packages and Interfaces OOC 4 th Sem, B Div 2016-17 Prof. Mouna M. Naravani Introducing Classes A class defines a new data type (User defined data type). This
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 informationEnglish 4 th Grade M-Z Vocabulary Cards and Word Walls Revised: 1/13/14
English 4 th Grade M-Z Vocabulary Cards and Word Walls Revised: 1/13/14 Important Notes for Teachers: The vocabulary cards in this file match the Common Core, the math curriculum adopted by the Utah State
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 informationLecture 3. The syntax for accessing a struct member is
Lecture 3 Structures: Structures are typically used to group several data items together to form a single entity. It is a collection of variables used to group variables into a single record. Thus a structure
More information4 WORKING WITH DATA TYPES AND OPERATIONS
WORKING WITH NUMERIC VALUES 27 4 WORKING WITH DATA TYPES AND OPERATIONS WORKING WITH NUMERIC VALUES This application will declare and display numeric values. To declare and display an integer value in
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 informationChapters 1-4 Summary. Syntax - Java or C? Syntax - Java or C?
Chapters 1-4 Summary These slides are brief summary of chapters 1-4 for students already familiar with programming in C or C++. Syntax - Java or C? int x[]={1,2,3,4,5,6,7,8,9,10; int i; int sum=0; float
More informationCIS 110: Introduction to Computer Programming. Lecture 2 Decomposition and Static Methods ( 1.4)
CIS 110: Introduction to Computer Programming Lecture 2 Decomposition and Static Methods ( 1.4) Outline Structure and redundancy in algorithms Static methods Procedural decomposition 9/16/2011 CIS 110
More informationFractions, Decimals, Ratio and Percentages (FDRP) Measures (MEA)
Termly assessment Number and Place Value (NPV) Addition and Subtraction (AS) Multiplication and Division (MD) Fractions, Decimals, Ratio and Percentages (FDRP) Measures (MEA) Geometry (GEO) Statistics
More informationLinby Primary School Targets Ladder. Linby Primary School Targets Ladder
Target Sheet 1a I can read numbers to 10 (1, 2, 3 etc) written as digits 1,2,3,.Make sure you can do this out of order (5, 9, 2) I can count up to 10 objects accurately and consistently. (Both things that
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 informationSAINT JOHN PAUL II CATHOLIC ACADEMY. Entering Grade 5 Summer Math
SAINT JOHN PAUL II CATHOLIC ACADEMY Entering Grade 5 Summer Math 2018 In Grade 4 You Learned To: Operations and Algebraic Thinking Use the four operations with whole numbers to solve problems. Gain familiarity
More informationIntroduction. Lecture 1 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz
Introduction Lecture 1 MIT 12043, Fundamentals of Programming By: Programming Languages There are hundreds of programming languages. Very broadly these languages are categorized as o Low Level Languages
More informationFor Exercises 2 4, find the volume and the surface area of each closed box.
Applications 1. a. Make a sketch of an open 1-3-5 box. Label the edges of the box. b. Sketch three boxes that have twice the volume of a 1-3-5 box. Label each box with its dimensions. c. Are any of the
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 informationCONTENTS: Arrays Strings. COMP-202 Unit 5: Loops in Practice
CONTENTS: Arrays Strings COMP-202 Unit 5: Loops in Practice Computing the mean of several numbers Suppose we want to write a program which asks the user to enter several numbers and then computes the average
More informationCourse Outline. Introduction to java
Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.
More informationCOMP 202 Java in one week
CONTENTS: Basics of Programming Variables and Assignment Data Types: int, float, (string) Example: Implementing a calculator COMP 202 Java in one week The Java Programming Language A programming language
More informationEnglish 4 th Grade M-Z Vocabulary Cards and Word Walls Revised: June 3, 2013
English 4 th Grade M-Z Vocabulary Cards and Word Walls Revised: June 3, 2013 Important Notes for Teachers: The vocabulary cards in this file match the Common Core, the math curriculum adopted by the Utah
More informationLecture 12. Data Types and Strings
Lecture 12 Data Types and Strings Class v. Object A Class represents the generic description of a type. An Object represents a specific instance of the type. Video Game=>Class, WoW=>Instance Members of
More informationCISC-124. Dog.java looks like this. I have added some explanatory comments in the code, and more explanation after the code listing.
CISC-124 20180115 20180116 20180118 We continued our introductory exploration of Java and object-oriented programming by looking at a program that uses two classes. We created a Java file Dog.java and
More informationOral and Mental calculation
Oral and Mental calculation Read and write any integer and know what each digit represents. Read and write decimal notation for tenths, hundredths and thousandths and know what each digit represents. Order
More informationInput & Output in Java. Standard I/O Exception Handling
Input & Output in Java Standard I/O Exception Handling Java I/O: Generic & Complex Java runs on a huge variety of plaforms to accomplish this, a Java Virtual Machine (JVM) is written for every type of
More informationJava Reference Card. 1. Classes. 2. Methods. 3. Conditionals. 4. Operators
Java Reference Card 1. Classes The following is an example of a main class: public class Calculator { public static void main(string[] args) { and the following is an example of a utility class (with no
More informationControls Structure for Repetition
Controls Structure for Repetition So far we have looked at the if statement, a control structure that allows us to execute different pieces of code based on certain conditions. However, the true power
More informationExample: Monte Carlo Simulation 1
Example: Monte Carlo Simulation 1 Write a program which conducts a Monte Carlo simulation to estimate π. 1 See https://en.wikipedia.org/wiki/monte_carlo_method. Zheng-Liang Lu Java Programming 133 / 149
More informationAgenda: Discussion Week 7. May 11, 2009
Agenda: Discussion Week 7 Method signatures Static vs. instance compareto Exceptions Interfaces 2 D arrays Recursion varargs enum Suggestions? May 11, 2009 Method signatures [protection] [static] [return
More informationSect Volume. 3 ft. 2 ft. 5 ft
199 Sect 8.5 - Volume Objective a & b: Understanding Volume of Various Solids The Volume is the amount of space a three dimensional object occupies. Volume is measured in cubic units such as in or cm.
More informationMaths - Knowledge Key Performance Indicator Milestones Milestones Year 5 Year 6
Addition and Subtraction Number and Place Value Maths - Knowledge Key Performance Indicator Milestones Milestones Year 5 Year 6 I can read numbers to at least 1 000 000 I can write numbers to at least
More informationFinding Pi: Applications of Loops, Random Numbers, Booleans CS 8: Introduction to Computer Science, Winter 2018 Lecture #6
Finding Pi: Applications of Loops, Random Numbers, Booleans CS 8: Introduction to Computer Science, Winter 2018 Lecture #6 Ziad Matni Dept. of Computer Science, UCSB Administrative New Homework (#3) is
More information