Computational Applications in Nuclear Astrophysics using Java Java course Lecture 3

Size: px
Start display at page:

Download "Computational Applications in Nuclear Astrophysics using Java Java course Lecture 3"

Transcription

1 Computational Applications in Nuclear Astrophysics using Java Java course Lecture 3 Prepared for course /411 Michael C. Kunkel m.kunkel@fz-juelich.de Materials taken from; docs.oracle.com Teach Yourself Java ISBN

2 Maven Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.

3 Maven We will use maven for our project dependancies Lets look at our pom file you have from the Github project

4 Java

5 Java

6 Methods in Java A method is a block of statements that are grouped together to perform an operation or specific task The equivalent of Java methods in C and C ++ are functions Methods are used to divide code into logical pieces Methods can return values, or just perform an operation

7 Class Work Create a package in Eclipse Name it thirdclass Create a public class named MyMethods Lets create a method called printhello that will take 2 arguments of String and int Example on next slide Create a main method call the printhello method

8 Java

9 Class Work Using the package thirdclass Using the public class named MyMethods Lets create a method called printstring that will take 0 arguments and return a String Example on next slide In the main method call the string value of printstring

10 Class Work

11 Method Overloading A class can have multiple methods having the same name but different parameters. This is known as method overloading Having the same method name that performs the same operation increases the readability of a program To overload a method Change the number of parameter Change the data type of of one parameter In Java it is not possible to overload a method by simply changing the return type.

12 Class Work Using the package thirdclass Using the public class named MyMethods Lets create a method called myoverload that will take 1 parameter Lets overload the method called myoverload 2 parameters " "3 parmeters Example on next slide In the main method call all 3 overloaded methods

13 Class Work

14 Class Work Using the package thirdclass Using the public class named OnlyGravitationalHeating Keep the mass and luminosity of the sun constant, write a method that will return what the radius of the sun would be today, if the only source of energy was gravitational heating Overload this method to take an integer as input and return the radius of the sun if it were to have enough heat for X*ageOfSun You may use the Constants package

15 Class Work Using the package thirdclass Using the public class named SemiEmpiricalMassFormula Write a method that returns the binding energy for parameters N and Z You may use the Constants package You may update the Constants package

16 Java Loops for loop A for loop is a looping stamens that allows you to execute a code block a specific amount of times for(initialization;termination;incerement)

17 Java Loops A nested for loop A nested for loop is a for loop in a for loop

18 Java Loops for loop can also be missing some of its body Be careful, without the termination, you will get an infinite loop...try it! Press the red box in Eclipse to stop

19 Java Loops A foreach loop creates a loop that returns for each element of an array or iterable objects from the objects first element to its last

20 Java Loops A while is a loop that repeats while a condition is true Be careful, without the increment, you will get an infinite loop...try it! Press the red box in Eclipse to stop Can be used on char. Try it, start from k='a' until k<='z' print the value of k

21 Java Loops A do-while loop is a loop that repeats while the condition is true. However, unlike a while loop, a do-while is checked at the bottom of the loop. Loops always get processed once!! Will not print anything = Will print. What will is print?

22 Visualizing Data in Java To visualize data, programmers usually use graphs or histograms. In this class we will use the COATJava package developed at the CEBAF Large Acceptance Spectrometer at The Jefferson National Laboratory

23 Visualizing Data in Java We have already imported the necessary dependancies with our POM file To instantiate a Graph GraphErrors gr = new GraphErrors(); To fill a graph gr.addpoint(x,y,errorx, errory);

24 Visualizing Data in Java To instantiate a Histogram 1 Dimensional H1F ah1f = new H1F(name, bins, xmin, xmax); 2 Dimensional H2F ah2f = new H2F(name, title, bx, xmin, xmax, by, ymin, ymax); To fill a Histogram ah1f.fill(bin,value); ah2f.fill(binx, biny, value);

25 Visualizing Data in Java To visualize a graph or histogram After the graph has all values TCanvas canvas = new TCanvas("a Canvas", 800, 800); canvas.draw(gr); To save a graph, use the domain.utils package SaveCanvas.saveCanvas(canvas);

26 Visualizing Data in Java Solar radius with only gravitational heating Solar radius [r sun] Solar age [t sun]

27 Homework Make a graph in that shows radius of the sun for 1*ageOfSun-20*ageOfSun (put in units of current solar radius) Submit to Github Extra Credit Try to use Eclipse's content assist to find how to label the x and y axes, as well as give a name to the graph/plot (If you label you should also use units!!)

28 Next Class More Java Code examples from lecture 2 lecture 3

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 4

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 4 Computational Applications in Nuclear Astrophysics using Java Java course Lecture 4 Prepared for course 160410/411 Michael C. Kunkel m.kunkel@fz-juelich.de Materials taken from; docs.oracle.com Teach Yourself

More information

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 2

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 2 Computational Applications in Nuclear Astrophysics using Java Java course Lecture 2 Prepared for course 160410/411 Michael C. Kunkel m.kunkel@fz-juelich.de Materials taken from; docs.oracle.com Teach Yourself

More information

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 1

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 1 Computational Applications in Nuclear Astrophysics using Java Java course Lecture 1 Prepared for course 160410/411 Michael C. Kunkel m.kunkel@fz-juelich.de Materials taken from; docs.oracle.com Teach Yourself

More information

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 6

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 6 Computational Applications in Nuclear Astrophysics using Java Java course Lecture 6 Prepared for course 160410/411 Michael C. Kunkel m.kunkel@fz-juelich.de Materials taken from; docs.oracle.com Teach Yourself

More information

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan Lecture 08-1 Programming in C++ PART 1 By Assistant Professor Dr. Ali Kattan 1 The Conditional Operator The conditional operator is similar to the if..else statement but has a shorter format. This is useful

More information

Programming in C++ PART 2

Programming in C++ PART 2 Lecture 07-2 Programming in C++ PART 2 By Assistant Professor Dr. Ali Kattan 1 The while Loop and do..while loop In the previous lecture we studied the for Loop in C++. In this lecture we will cover iteration

More information

Introduction to Programming Using Java (98-388)

Introduction 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 information

Exam 2. CSC 121 MW Class. Lecturer: Howard Rosenthal. April 26, 2017

Exam 2. CSC 121 MW Class. Lecturer: Howard Rosenthal. April 26, 2017 Your Name: Exam 2. CSC 121 MW Class Lecturer: Howard Rosenthal April 26, 2017 The following questions (or parts of questions) in numbers 1-7 are all worth 3 points each. 1. Answer the following as true

More information

COMP Primitive and Class Types. Yi Hong May 14, 2015

COMP Primitive and Class Types. Yi Hong May 14, 2015 COMP 110-001 Primitive and Class Types Yi Hong May 14, 2015 Review What are the two major parts of an object? What is the relationship between class and object? Design a simple class for Student How to

More information

Comp Assignment 2: Object-Oriented Scanning for Numbers, Words, and Quoted Strings

Comp Assignment 2: Object-Oriented Scanning for Numbers, Words, and Quoted Strings Comp 401 - Assignment 2: Object-Oriented Scanning for Numbers, Words, and Quoted Strings Date Assigned: Thu Aug 29, 2013 Completion Date: Fri Sep 6, 2013 Early Submission Date: Wed Sep 4, 2013 This work

More information

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Hello, in this lecture we will learn about some fundamentals concepts of java.

More information

CS1004: Intro to CS in Java, Spring 2005

CS1004: Intro to CS in Java, Spring 2005 CS1004: Intro to CS in Java, Spring 2005 Lecture #16: Java conditionals/loops, cont d. Janak J Parekh janak@cs.columbia.edu Administrivia Midterms returned now Weird distribution Mean: 35.4 ± 8.4 What

More information

Lecture 14 CSE11 Fall 2013 For loops, Do While, Break, Continue

Lecture 14 CSE11 Fall 2013 For loops, Do While, Break, Continue Lecture 14 CSE11 Fall 2013 For loops, Do While, Break, Continue General Loops in Java Look at other loop constructions Very common while loop: do a loop a fixed number of times (MAX in the example) int

More information

ECE 122. Engineering Problem Solving with Java

ECE 122. Engineering Problem Solving with Java ECE 122 Engineering Problem Solving with Java Lecture 10 For Loops and Arrays Outline Problem: How can I perform the same operations a fixed number of times? Considering for loops Performs same operations

More information

Organizing and Summarizing Data

Organizing and Summarizing Data Section 2.2 9 Organizing and Summarizing Data Section 2.2 C H A P T E R 2 4 Example 2 (pg. 72) A Histogram for Discrete Data To create a histogram, you have two choices: 1): enter all the individual data

More information

Lesson 8 - Practice Problems

Lesson 8 - Practice Problems Lesson 8 - Practice Problems Section 8.1: A Case for the Quadratic Formula 1. For each quadratic equation below, show a graph in the space provided and circle the number and type of solution(s) to that

More information

CSC Java Programming, Fall Java Data Types and Control Constructs

CSC 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 information

Outline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail.

Outline. 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 information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science Department Lecture 3: C# language basics Lecture Contents 2 C# basics Conditions Loops Methods Arrays Dr. Amal Khalifa, Spr 2015 3 Conditions and

More information

COP 3014: Fall Final Study Guide. December 5, You will have an opportunity to earn 15 extra credit points.

COP 3014: Fall Final Study Guide. December 5, You will have an opportunity to earn 15 extra credit points. COP 3014: Fall 2017 Final Study Guide December 5, 2017 The test consists of 1. 15 multiple choice questions - 30 points 2. 2 find the output questions - 20 points 3. 2 code writing questions - 30 points

More information

BCIS 3630 Dr. GUYNES SPRING 2018 TUESDAY SECTION [JAN version] GRADER COURSE WEBSITE

BCIS 3630 Dr. GUYNES SPRING 2018 TUESDAY SECTION [JAN version] GRADER   COURSE WEBSITE COURSE WEBSITE http://www.steveguynes.com/bcis3630/bcis3630/default.html Instructor: Dr. Guynes Office: BLB 312H Phone: (940) 565-3110 Office Hours: By Email Email: steve.guynes@unt.edu TEXTBOOK: Starting

More information

What is PHP? [1] Figure 1 [1]

What is PHP? [1] Figure 1 [1] PHP What is PHP? [1] PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP is free to download and use Figure

More information

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs.

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs. Java SE11 Development Java is the most widely-used development language in the world today. It allows programmers to create objects that can interact with other objects to solve a problem. Explore Java

More information

Python for Analytics. Python Fundamentals RSI Chapters 1 and 2

Python for Analytics. Python Fundamentals RSI Chapters 1 and 2 Python for Analytics Python Fundamentals RSI Chapters 1 and 2 Learning Objectives Theory: You should be able to explain... General programming terms like source code, interpreter, compiler, object code,

More information

Second Year C and R Assignment

Second Year C and R Assignment Prof. R. Willingale January 16, 2017 University Road Leicester LE1 7RH Telephone +44-116-252-3556 Internet http://www.star.le.ac.uk/zrw Email zrw@le.ac.uk Contents 1 Introduction 2 2 The Investigation

More information

Chapter 6. Arrays. Java Actually: A Comprehensive Primer in Programming

Chapter 6. Arrays. Java Actually: A Comprehensive Primer in Programming Lecture slides for: Chapter 6 Arrays Java Actually: A Comprehensive Primer in Programming Khalid Azim Mughal, Torill Hamre, Rolf W. Rasmussen Cengage Learning, 28. ISBN: 978-1-84448-933-2 http://www.ii.uib.no/~khalid/jac/

More information

Lesson 11 Rational Functions

Lesson 11 Rational Functions Lesson 11 Rational Functions In this lesson, you will embark on a study of rational functions. These may be unlike any function you have ever seen. Rational functions look different because they are in

More information

Decision Making and Loops

Decision Making and Loops Decision Making and Loops Goals of this section Continue looking at decision structures - switch control structures -if-else-if control structures Introduce looping -while loop -do-while loop -simple for

More information

The parametric equation below represents a ball being thrown straight up. x(t) = 3 y(t) = 96t! 16t 2

The parametric equation below represents a ball being thrown straight up. x(t) = 3 y(t) = 96t! 16t 2 1 TASK 3.1.2: THROWING Solutions The parametric equation below represents a ball being thrown straight up. x(t) = 3 y(t) = 96t! 16t 2 1. What do you think the graph will look like? Make a sketch below.

More information

Exam 1 Prep. Dr. Demetrios Glinos University of Central Florida. COP3330 Object Oriented Programming

Exam 1 Prep. Dr. Demetrios Glinos University of Central Florida. COP3330 Object Oriented Programming Exam 1 Prep Dr. Demetrios Glinos University of Central Florida COP3330 Object Oriented Programming Progress Exam 1 is a Timed Webcourses Quiz You can find it from the "Assignments" link on Webcourses choose

More information

Exam 2. CSC 121 MW Class. Lecturer: Howard Rosenthal. April 25, 2016

Exam 2. CSC 121 MW Class. Lecturer: Howard Rosenthal. April 25, 2016 Your Name: Exam 2. CSC 121 MW Class Lecturer: Howard Rosenthal April 25, 2016 The following questions (or parts of questions) in numbers 1-7 are all worth 3 points each. 1. Answer the following as true

More information

CS 61B Discussion 5: Inheritance II Fall 2014

CS 61B Discussion 5: Inheritance II Fall 2014 CS 61B Discussion 5: Inheritance II Fall 2014 1 WeirdList Below is a partial solution to the WeirdList problem from homework 3 showing only the most important lines. Part A. Complete the implementation

More information

Lecture 8 CSE11 Fall 2013 While Loops, Switch Statement, Simplifying Conditionals

Lecture 8 CSE11 Fall 2013 While Loops, Switch Statement, Simplifying Conditionals Lecture 8 CSE11 Fall 2013 While Loops, Switch Statement, Simplifying Conditionals What are Computers Really Good at? Complex calculations Repetitive tasks Identifying repetition is key to many programming

More information

The List Datatype. CSc 372. Comparative Programming Languages. 6 : Haskell Lists. Department of Computer Science University of Arizona

The List Datatype. CSc 372. Comparative Programming Languages. 6 : Haskell Lists. Department of Computer Science University of Arizona The List Datatype CSc 372 Comparative Programming Languages 6 : Haskell Lists Department of Computer Science University of Arizona collberg@gmail.com All functional programming languages have the ConsList

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 4 C Pointers 2004-09-08 Lecturer PSOE Dan Garcia www.cs.berkeley.edu/~ddgarcia Cal flies over Air Force We re ranked 13 th in the US and

More information

CIS192: Python Programming

CIS192: Python Programming CIS192: Python Programming Introduction Harry Smith University of Pennsylvania January 18, 2017 Harry Smith (University of Pennsylvania) CIS 192 Lecture 1 January 18, 2017 1 / 34 Outline 1 Logistics Rooms

More information

Structured Programming

Structured Programming CS 170 Java Programming 1 Objects and Variables A Little More History, Variables and Assignment, Objects, Classes, and Methods Structured Programming Ideas about how programs should be organized Functionally

More information

Java Programming. Manuel Oriol, March 22nd, 2007

Java Programming. Manuel Oriol, March 22nd, 2007 Java Programming Manuel Oriol, March 22nd, 2007 Goal Teach Java to proficient programmers 2 Roadmap Java Basics Eclipse Java GUI Threads and synchronization Class loading and reflection Java Virtual Machines

More information

Object Oriented Programming and Design in Java. Session 2 Instructor: Bert Huang

Object Oriented Programming and Design in Java. Session 2 Instructor: Bert Huang Object Oriented Programming and Design in Java Session 2 Instructor: Bert Huang Announcements TA: Yipeng Huang, yh2315, Mon 4-6 OH on MICE clarification Next Monday's class canceled for Distinguished Lecture:

More information

Setting a Window - Finding One That Works. You can enter the dimensions of the graph by accessing button you will see a window like the one below.

Setting a Window - Finding One That Works. You can enter the dimensions of the graph by accessing button you will see a window like the one below. A. Overview 1. WINDOW Setting a Window - Finding One That Works You can enter the dimensions of the graph by accessing button you will see a window like the one below.. When you use this The Xmin and Xmax

More information

Honors Algebra 3-4 Mr. Felling Expanded Topic - Curve Fitting Extra Credit Project

Honors Algebra 3-4 Mr. Felling Expanded Topic - Curve Fitting Extra Credit Project Honors Algebra 3-4 Mr. Felling Expanded Topic - Curve Fitting Extra Credit Project 'Real-world' math problems often state things like 'The demand function for a product is 2.3 p ( e ) D = 30 1 10 where

More information

Computer Programming: C++

Computer Programming: C++ The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming: C++ Experiment #7 Arrays Part II Passing Array to a Function

More information

Root programming and data analysis

Root programming and data analysis Special Praktikum: Root programming and data analysis Ascii data: Co60.dat Ge detector t Preamplifier Shaping amp. MCA γ 60Co γ-source 1173 and 1333 kev Ascii data Ascii data: Each line: corresponds to

More information

Q. State and Explain steps involved in program development. [w-08, w-10, s-12, w-11]

Q. State and Explain steps involved in program development. [w-08, w-10, s-12, w-11] Q. State and Explain steps involved in program development. [w-08, w-10, s-12, w-11] Answer: 1. Defining Problem 2. Algorithm 3. Flowchart 4. Initialization of checklist 5. Choosing instructions 6. Converting

More information

Chapter 7:: Data Types. Mid-Term Test. Mid-Term Test (cont.) Administrative Notes

Chapter 7:: Data Types. Mid-Term Test. Mid-Term Test (cont.) Administrative Notes Chapter 7:: Data Types Programming Language Pragmatics Michael L. Scott Administrative Notes Mid-Term Test Thursday, July 27 2006 at 11:30am No lecture before or after the mid-term test You are responsible

More information

Repetition Structures II

Repetition Structures II Lecture 9 Repetition Structures II For and do-while loops CptS 121 Summer 2016 Armen Abnousi Types of Control Structures Sequential All programs that we have written so far The statements inside a pair

More information

I ve been getting this a lot lately So, what are you teaching this term? Computer Organization. Do you mean, like keeping your computer in place?

I ve been getting this a lot lately So, what are you teaching this term? Computer Organization. Do you mean, like keeping your computer in place? I ve been getting this a lot lately So, what are you teaching this term? Computer Organization. Do you mean, like keeping your computer in place? here s the monitor, here goes the CPU, Do you need a class

More information

CS210 Project 5 (Kd-Trees) Swami Iyer

CS210 Project 5 (Kd-Trees) Swami Iyer The purpose of this assignment is to create a symbol table data type whose keys are two-dimensional points. We ll use a 2d-tree to support efficient range search (find all the points contained in a query

More information

Calculator Tables and Graphs

Calculator Tables and Graphs " Calculator Tables and Graphs In the last investigation, you wrote equations to describe patterns and to show how variables are related. Such equations are used in mathematics, science, economics, and

More information

CMSC 330: Organization of Programming Languages. Lets, Tuples, Records

CMSC 330: Organization of Programming Languages. Lets, Tuples, Records CMSC 330: Organization of Programming Languages Lets, Tuples, Records CMSC330 Spring 2018 1 Let Expressions Enable binding variables in other expressions These are different from the let definitions we

More information

Review. Primitive Data Types & Variables. String Mathematical operators: + - * / % Comparison: < > <= >= == int, long float, double boolean char

Review. Primitive Data Types & Variables. String Mathematical operators: + - * / % Comparison: < > <= >= == int, long float, double boolean char Review Primitive Data Types & Variables int, long float, double boolean char String Mathematical operators: + - * / % Comparison: < > = == 1 1.3 Conditionals and Loops Introduction to Programming in

More information

Chpt 1. Functions and Graphs. 1.1 Graphs and Graphing Utilities 1 /19

Chpt 1. Functions and Graphs. 1.1 Graphs and Graphing Utilities 1 /19 Chpt 1 Functions and Graphs 1.1 Graphs and Graphing Utilities 1 /19 Chpt 1 Homework 1.1 14, 18, 22, 24, 28, 42, 46, 52, 54, 56, 78, 79, 80, 82 2 /19 Objectives Functions and Graphs Plot points in the rectangular

More information

Structures, Operators

Structures, Operators Structures Typedef Operators Type conversion Structures, Operators Basics of Programming 1 G. Horváth, A.B. Nagy, Z. Zsóka, P. Fiala, A. Vitéz 10 October, 2018 c based on slides by Zsóka, Fiala, Vitéz

More information

MATLAB. MATLAB Review. MATLAB Basics: Variables. MATLAB Basics: Variables. MATLAB Basics: Subarrays. MATLAB Basics: Subarrays

MATLAB. MATLAB Review. MATLAB Basics: Variables. MATLAB Basics: Variables. MATLAB Basics: Subarrays. MATLAB Basics: Subarrays MATLAB MATLAB Review Selim Aksoy Bilkent University Department of Computer Engineering saksoy@cs.bilkent.edu.tr MATLAB Basics Top-down Program Design, Relational and Logical Operators Branches and Loops

More information

Lesson 2.4 Arraylist

Lesson 2.4 Arraylist Lesson 24 Arraylist Mimi Duong Rosalba Rodriguez Java Crash Course January 6th, 2015 Data Structure ArrayLists Live Coding Methods Searching Through ArrayLists Classwork Storing Items in Java How have

More information

python 01 September 16, 2016

python 01 September 16, 2016 python 01 September 16, 2016 1 Introduction to Python adapted from Steve Phelps lectures - (http://sphelps.net) 2 Python is interpreted Python is an interpreted language (Java and C are not). In [1]: 7

More information

CSE115 / 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 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 information

Chapel Introduction and

Chapel Introduction and Lecture 24 Chapel Introduction and Overview of X10 and Fortress John Cavazos Dept of Computer & Information Sciences University of Delaware www.cis.udel.edu/~cavazos/cisc879 But before that Created a simple

More information

Embedded Controller Programming 2

Embedded Controller Programming 2 Embedded Controller Programming 2 Section 3: C Language for Embedded Systems - Ken Arnold ecp2@hte.com Copyright 2006 Ken Arnold Overview Structures Unions Scope of Variables Pointers Operators and Precedence

More information

ENGINEERING 1020 Introduction to Computer Programming M A Y 2 6, R E Z A S H A H I D I

ENGINEERING 1020 Introduction to Computer Programming M A Y 2 6, R E Z A S H A H I D I ENGINEERING 1020 Introduction to Computer Programming M A Y 2 6, 2 0 1 0 R E Z A S H A H I D I Today s class Constants Assignment statement Parameters and calling functions Expressions Mixed precision

More information

advanced data types (2) typedef. today advanced data types (3) enum. mon 23 sep 2002 defining your own types using typedef

advanced data types (2) typedef. today advanced data types (3) enum. mon 23 sep 2002 defining your own types using typedef today advanced data types (1) typedef. mon 23 sep 2002 homework #1 due today homework #2 out today quiz #1 next class 30-45 minutes long one page of notes topics: C advanced data types dynamic memory allocation

More information

Lines and Circles Guided Practice: Teacher Instructions

Lines and Circles Guided Practice: Teacher Instructions Lines and Circles Guided Practice: Teacher Instructions Overview 1. Together, as a class, go through the Lines and Circles Guided Practice (exercises 1-22) described below. 2. Then have student teams conduct

More information

QUIZ on Ch.5. Why is it sometimes not a good idea to place the private part of the interface in a header file?

QUIZ on Ch.5. Why is it sometimes not a good idea to place the private part of the interface in a header file? QUIZ on Ch.5 Why is it sometimes not a good idea to place the private part of the interface in a header file? Example projects where we don t want the implementation visible to the client programmer: The

More information

S-1. Concepts this lecture. CSE 142 Computer Programming I. Chapter 11. Review: Data Structures. Problem: Account Records.

S-1. Concepts this lecture. CSE 142 Computer Programming I. Chapter 11. Review: Data Structures. Problem: Account Records. CSE 142 Computer Programming I Structures Concepts this lecture Review: Data structures Heterogenous structures (structs, records) struct type definitions (typedef) Field selection (. operator) Structs

More information

Computer Programming: Skills & Concepts (CP) arithmetic, if and booleans (cont)

Computer Programming: Skills & Concepts (CP) arithmetic, if and booleans (cont) CP Lect 5 slide 1 Monday 2 October 2017 Computer Programming: Skills & Concepts (CP) arithmetic, if and booleans (cont) Cristina Alexandru Monday 2 October 2017 Last Lecture Arithmetic Quadratic equation

More information

Repetition Structures

Repetition Structures Repetition Structures Chapter 5 Fall 2016, CSUS Introduction to Repetition Structures Chapter 5.1 1 Introduction to Repetition Structures A repetition structure causes a statement or set of statements

More information

Condition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution.

Condition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution. Repetition Structures Introduction to Repetition Structures Chapter 5 Spring 2016, CSUS Chapter 5.1 Introduction to Repetition Structures The Problems with Duplicate Code A repetition structure causes

More information

CS 361 Computer Systems Fall 2017 Homework Assignment 4 - Inter-Process Communications & I/O

CS 361 Computer Systems Fall 2017 Homework Assignment 4 - Inter-Process Communications & I/O CS 361 Computer Systems Fall 2017 Homework Assignment 4 - Inter-Process Communications & I/O Overall Assignment For this assignment, you are to write three programs that will work together using inter-process

More information

Introduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017

Introduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017 Introduction to OOP with Java Instructor: AbuKhleif, Mohammad Noor Sep 2017 Lecture 07: OOP Part 1 Instructor: AbuKhleif, Mohammad Noor Sep 2017 Instructor AbuKhleif, Mohammad Noor Computer Engineer (JU

More information

Overview. Lecture 13: Graphics and Visualisation. Graphics & Visualisation 2D plotting. Graphics and visualisation of data in Matlab

Overview. Lecture 13: Graphics and Visualisation. Graphics & Visualisation 2D plotting. Graphics and visualisation of data in Matlab Overview Lecture 13: Graphics and Visualisation Graphics & Visualisation 2D plotting 1. Plots for one or multiple sets of data, logarithmic scale plots 2. Axis control & Annotation 3. Other forms of 2D

More information

Thursday, February 16, More C++ and root

Thursday, February 16, More C++ and root More C++ and root Today s Lecture Series of topics from C++ Example of thinking though a problem Useful physics classes in ROOT Functions by this point you are used to the syntax of a function pass by

More information

} Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = / 2; 3. int x = 5 / ; 4. double x = 5 / 2.

} Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = / 2; 3. int x = 5 / ; 4. double x = 5 / 2. Class #10: Understanding Primitives and Assignments Software Design I (CS 120): M. Allen, 19 Sep. 18 Java Arithmetic } Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = 2 + 5 / 2; 3.

More information

DATA STRUCTURES USING C

DATA STRUCTURES USING C DATA STRUCTURES USING C Lecture-7 Data Structures Lecture Objectives After studying this chapter, the student should be able to: Define a data structure. Define an array as a data structure and how it

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #06 Loops: Operators

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #06 Loops: Operators Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #06 Loops: Operators We have seen comparison operators, like less then, equal to, less than or equal. to and

More information

F1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept

F1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept F1 A Java program Ch 1 in PPIJ Introduction to the course The computer and its workings The algorithm concept The structure of a Java program Classes and methods Variables Program statements Comments Naming

More information

Chapter. Implicit Function Graphs

Chapter. Implicit Function Graphs Chapter 14 Implicit Function Graphs You can graph any one of the following types of implicit functions using the calculator s built-in functions. Parabolic graph Circle graph Elliptical graph Hyperbolic

More information

COMP 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 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 information

Principles of Autonomy and Decision Making

Principles of Autonomy and Decision Making Massachusetts Institute of Technology 16.410-13 Principles of Autonomy and Decision Making Problem Set #2 Objective You will implement in Java the following search algorithms: 1. Depth-first 2. Breadth-first.

More information

QUIZ. Can you find 5 errors in this code?

QUIZ. Can you find 5 errors in this code? QUIZ Can you find 5 errors in this code? QUIZ What (if anything) is wrong with this code? public: ; int Constructor argument need! QUIZ What is meant by saying that a variable hides another? I.e. have

More information

W3101: Programming Languages C++ Ramana Isukapalli

W3101: Programming Languages C++ Ramana Isukapalli Lecture-6 Operator overloading Namespaces Standard template library vector List Map Set Casting in C++ Operator Overloading Operator overloading On two objects of the same class, can we perform typical

More information

Fundamentals of Programming Session 13

Fundamentals of Programming Session 13 Fundamentals of Programming Session 13 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2014 These slides have been created using Deitel s slides Sharif University of Technology Outlines

More information

Section 1.6. Inverse Functions

Section 1.6. Inverse Functions Section 1.6 Inverse Functions Important Vocabulary Inverse function: Let f and g be two functions. If f(g(x)) = x in the domain of g and g(f(x) = x for every x in the domain of f, then g is the inverse

More information

CS111: PROGRAMMING LANGUAGE II

CS111: 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 information

Assignment #2: Intro to Java Due: 11AM PST on Wednesday, July 12

Assignment #2: Intro to Java Due: 11AM PST on Wednesday, July 12 Nick Troccoli Assignment 2 CS 106A July 5, 2017 Assignment #2: Intro to Java Due: 11AM PST on Wednesday, July 12 This assignment should be done individually (not in pairs) Based on handouts by Mehran Sahami,

More information

ESc101 : Fundamental of Computing

ESc101 : Fundamental of Computing ESc101 : Fundamental of Computing I Semester 2008-09 Lecture 9+10 Types Range of numeric types and literals (constants) in JAVA Expressions with values of mixed types 1 I : Range of numeric types and literals

More information

Programming, numerics and optimization

Programming, numerics and optimization Programming, numerics and optimization Lecture A-2: Programming basics II Łukasz Jankowski ljank@ippt.pan.pl Institute of Fundamental Technological Research Room 4.32, Phone +22.8261281 ext. 428 March

More information

CISC 1600, Lab 3.1: Processing

CISC 1600, Lab 3.1: Processing CISC 1600, Lab 3.1: Processing Prof Michael Mandel 1 Getting set up For this lab, we will be using OpenProcessing, a site for building processing sketches online using processing.js. 1.1. Go to https://www.openprocessing.org/class/57767/

More information

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++ Introduction to Programming in C++ Course Text Programming in C++, Zyante, Fall 2013 edition. Course book provided along with the course. Course Description This course introduces programming in C++ and

More information

Programming Using C Homework 5

Programming Using C Homework 5 Programming Using C Homework 5 1. In this problem you will simulate the execution of a computer s CPU. The computer that we will simulate has 32 bytes of addressable memory (each byte is uniquely addressed).

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE. Lecture 3: C# language basics II

CS313D: ADVANCED PROGRAMMING LANGUAGE. Lecture 3: C# language basics II CS313D: ADVANCED PROGRAMMING LANGUAGE Lecture 3: C# language basics II Lecture Contents 2 C# basics Methods Arrays Methods 3 A method: groups a sequence of statement takes input, performs actions, and

More information

Writeup for first project of CMSC 420: Data Structures Section 0102, Summer Theme: Threaded AVL Trees

Writeup for first project of CMSC 420: Data Structures Section 0102, Summer Theme: Threaded AVL Trees Writeup for first project of CMSC 420: Data Structures Section 0102, Summer 2017 Theme: Threaded AVL Trees Handout date: 06-01 On-time deadline: 06-09, 11:59pm Late deadline (30% penalty): 06-11, 11:59pm

More information

CSE : Python Programming

CSE : Python Programming CSE 399-004: Python Programming Lecture 2: Data, Classes, and Modules January 22, 2007 http://www.seas.upenn.edu/~cse39904/ Administrative things Teaching assistant Brian Summa (bsumma @ seas.upenn.edu)

More information

Loops. Repeat after me

Loops. Repeat after me Loops Repeat after me 1 Loops A loop is a control structure in which a statement or set of statements execute repeatedly How many times the statements repeat is determined by the value of a control variable,

More information

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java

More information

Lesson 10: Quiz #1 and Getting User Input (W03D2)

Lesson 10: Quiz #1 and Getting User Input (W03D2) Lesson 10: Quiz #1 and Getting User Input (W03D2) Balboa High School Michael Ferraro September 1, 2015 1 / 13 Do Now: Prep GitHub Repo for PS #1 You ll need to submit the 5.2 solution on the paper form

More information

CS61C Machine Structures. Lecture 4 C Pointers and Arrays. 1/25/2006 John Wawrzynek. www-inst.eecs.berkeley.edu/~cs61c/

CS61C Machine Structures. Lecture 4 C Pointers and Arrays. 1/25/2006 John Wawrzynek. www-inst.eecs.berkeley.edu/~cs61c/ CS61C Machine Structures Lecture 4 C Pointers and Arrays 1/25/2006 John Wawrzynek (www.cs.berkeley.edu/~johnw) www-inst.eecs.berkeley.edu/~cs61c/ CS 61C L04 C Pointers (1) Common C Error There is a difference

More information

2nd Year Computational Physics Week 1 (experienced): Series, sequences & matrices

2nd Year Computational Physics Week 1 (experienced): Series, sequences & matrices 2nd Year Computational Physics Week 1 (experienced): Series, sequences & matrices 1 Last compiled September 28, 2017 2 Contents 1 Introduction 5 2 Prelab Questions 6 3 Quick check of your skills 9 3.1

More information

Clouds, biological growth, and coastlines are

Clouds, biological growth, and coastlines are L A B 11 KOCH SNOWFLAKE Fractals Clouds, biological growth, and coastlines are examples of real-life phenomena that seem too complex to be described using typical mathematical functions or relationships.

More information

- HALF YEARLY EXAM ANSWER KEY DEC-2016 COMPUTER SCIENCE ENGLISH MEDIUM

- HALF YEARLY EXAM ANSWER KEY DEC-2016 COMPUTER SCIENCE ENGLISH MEDIUM www.padasalai.net - HALF YEARLY EXAM ANSWER KEY DEC-2016 COMPUTER SCIENCE ENGLISH MEDIUM 1 A 26 D 51 C 2 C 27 D 52 D 3 C 28 C 53 B 4 A 29 B 54 D 5 B 30 B 55 B 6 A 31 C 56 A 7 B 32 C 57 D 8 C 33 B 58 C

More information

CS 220: Introduction to Parallel Computing. Beginning C. Lecture 2

CS 220: Introduction to Parallel Computing. Beginning C. Lecture 2 CS 220: Introduction to Parallel Computing Beginning C Lecture 2 Today s Schedule More C Background Differences: C vs Java/Python The C Compiler HW0 8/25/17 CS 220: Parallel Computing 2 Today s Schedule

More information