CS001 Introduction to Programming Day 6 Sujana Jyothi

Slides:



Advertisements
Similar presentations
Your First Java Program: HelloWorld.java
Advertisements

Chapter 1 These slides for CSE 110 Sections are based in part on the textbook-authors’ slides, which are copyright by the authors. The authors state that.
How do we make our HelloTester.java program do something? The java in our HelloTester.java file won’t do anything by itself. We need to tell the computer.
Introduction to Computer Programming Decisions If/Else Booleans.
Java Intro. A First Java Program //The Hello, World! program in Java public class Hello { public static void main(String[] args) { System.out.println("Hello,
BASIC JAVA. Hello World n // Hello world program public class MyFirstJavaProgram { public static void main(String args[]) { char c = 'H'; String s =
Copyright 2006 by Pearson Education 1 reading: 4.1 Cumulative sum.
Java Overview February 4, /4/2004 Assignments Due – Homework 1 Due – Reading and Warmup questions Project 1 – Basic Networking.
Slide 1 of 40. Lecture A The Java Programming Language Invented 1995 by James Gosling at Sun Microsystems. Based on previous languages: C, C++, Objective-C,
 To be able to write larger programs ◦ By breaking them down into smaller parts and passing data between the parts.  To understand the concepts of Methods.
Lecture 7. Review Homework 1 (sample solution) Project 1 will be assigned next week –Draw a picture (whatever you want) in the world by using turtles.
Control Structures II. Why is Repetition Needed? There are many situations in which the same statements need to be executed several times. Example: Formulas.
Computer Programming Lab(4).
Unit 2: Java Introduction to Programming 2.1 Initial Example.
Laboratory Study October, The very first example, traditional "Hello World!" program: public class first { public static void main (String[ ]
CS107 Introduction to Computer Science Java Basics.
Welcome to the Lecture Series on “Introduction to Programming With Java”
Introduction to Java Thanks to Dan Lunney (SHS). Java Basics File names The “main” method Output to screen Escape Sequence – Special Characters format()
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
Programming Concept Chapter I Introduction to Java Programming.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
Java Fundamentals 3 Input and Output statements. Standard Output Window Using System.out, we can output multiple lines of text to the standard output.
CS 115 OBJECT ORIENTED PROGRAMMING I LECTURE 4 part 3 GEORGE KOUTSOGIANNAKIS.
Input & Output In Java. Input & Output It is very complicated for a computer to show how information is processed. Although a computer is very good at.
CHAPTER 1 INTRODUCTION. CHAPTER GOALS To understand the activity of programming To understand the activity of programming To learn about the architecture.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Methods (a.k.a. Functions)
Fall 2006Slides adapted from Java Concepts companion slides1 Introduction Advanced Programming ICOM 4015 Lecture 1 Reading: Java Concepts Chapter 1.
Methods F Hello World! F Java program compilation F Introducing Methods F Declaring Methods F Calling Methods F Passing Parameters by value F Overloading.
Jens Dalsgaard Nielsen Jan Dimon Bendtsen Dept. of Electronic Systems Basic Programming INS-basis GF, PDP and HST.
Repetition Statements while and do while loops
CS110 Programming Language I Lab 4: Control Statements I Computer Science Department Spring 2014.
Indentation & Readability. What does this program do? public class Hello { public static void main ( String[] args ) { //display initial message System.out.println(
Introduction to Computing Concepts Note Set 15. JOptionPane.showMessageDialog Message Dialog Allows you to give a brief message to the user Can be used.
The assignment expressions. The assignment operator in an assignment statement We have seen the assignment statement: Effect: var = expr; Stores the value.
Chapter 1 Introduction. Chapter Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code.
CONTROL STATEMENTS LOOPS. WHY IS REPETITION NEEDED?  There are many situations in which the same statements need to be executed several times.  Example:
Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have 45 – 90 seconds per question. Determine the output.
FOR LOOP WALK THROUGH public class NestedFor { public static void main(String [] args) { for (int i = 1; i
Java and C++ Transitioning. A simple example public class HelloWorldApp { public static void main(String[] args) { //Display the string. System.out.println("Hello.
CHAPTER 1 INTRODUCTION. CHAPTER GOALS To understand the activity of programming To learn about the architecture of computers To learn about machine code.
Chapter 9 Control Structures.
Method Examples CS 139 Algorithm Development 10/06/2008.
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
Methods What is a method? Main Method the main method is where a stand alone Java program normally begins execution common compile error, trying.
Computer Science I Lab 1 ISMAIL ABUMUHFOUZ | CS 180.
Methods. Creating your own methods Java allows you to create custom methods inside its main body. public class Test { // insert your own methods right.
UFCFY5-30-1Multimedia Studio Coding for Interactive Media Fundamental Concepts.
Introduction to java (class and object). Programming languages: –Easier to understand than CPU instructions –Needs to be translated for the CPU to understand.
Java Methods and Applications CSIS 3701: Advanced Object Oriented Programming.
Introduction to programming in java
John Woodward A Simple Program – Hello world
Department of Computer Science
Exercise Java programming
TK1114 Computer Programming
Something about Java Introduction to Problem Solving and Programming 1.
Decision statements. - They can use logic to arrive at desired results
Computing Adjusted Quiz Total Score
Chapter 9 Control Structures.
An Introduction to Java – Part I, language basics
Java Intro.
CS110D Programming Language I
class PrintOnetoTen { public static void main(String args[]) {
A Java Application public class Hello { public static void main(String [] args) { System.out.println("Hello, World!"); } } public class.
Methods and Data Passing
A Java Application public class Hello { public static void main(String [] args) { System.out.println("Hello, World!"); } } public class.
while while (condition) { statements }
Developing Java Applications with NetBeans
Developing Java Applications with NetBeans
Building Java Programs
Presentation transcript:

CS001 Introduction to Programming Day 6 Sujana Jyothi

2 What will you learn today? Learn to write programs Use the Java programming language

3 File HelloTester.java public class HelloTester { public static void main(String[] args) { // Display a greeting in the console window System.out.println(“hello, world"); } } public class HelloTester { public static void main(String[] args) { // Display a greeting in the console window System.out.println(“hello, world"); } } Output hello, world

Statement System.out.println(“hello, world”);

Example in Java

// Program to find the average of three numbers public class Average { public static void main(String[] args) { int number1 = 5; int number2 = 4; int number3 = 7; int sum = number1+number2+number3; int average = sum/3; System.out.println(“Sum is " + sum); System.out.println(" Average is" + average); }

Program to find if the first number is greater than or less than or equal to the second number public class Maximum { public static void main(String[] args) { int x = 10; int y = 20; // complete this }

// Program Multiples calculates the square and cube of a value public class Multiples { public static void main(String[] args) { int VALUE = 5; System.out.println("The number is " + VALUE); int VALUE1 = VALUE*VALUE; System.out.println(“squared is " + VALUE1); int VALUE2 = VALUE*VALUE*VALUE; System.out.println(" cubed is " + VALUE2); }