Chapter 1 Introduction to Java

Slides:



Advertisements
Similar presentations
Computer Programming Lab(7).
Advertisements

Computer Programming Lab 8.
CS 112 Intro to Computer Science II Sami Rollins Fall 2006.
11.3 Function Prototypes A Function Prototype contains the function’s return type, name and parameter list Writing the function prototype is “declaring”
CS150 Introduction to Computer Science 1
1 Session-7 CSIT 121 Spring 2006 Lab Demo of NiMo Lesson 3-2 Exercises 1,2,3,4,5,6 (Arithmetic Operators with Program ‘Convert.cpp’) Q&A about operators.
What is the best way to start? 1.Plug in n = 1. 2.Factor 6n 2 + 5n Let n be an integer. 4.Let n be an odd integer. 5.Let 6n 2 + 5n + 4 be an odd.
School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 4: 1 CMT1000: Introduction to Programming Ed Currie Lecture 5a: Input and.
1 10/9/06CS150 Introduction to Computer Science 1 for Loops.
1 Lab Session-3 CSIT 121 Fall 2004 Section-3 should finish Lab-1 Exercise first Division rules Operator precedence rules Lab Exercise.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Java Programming Practice.
1 Lab Session-3 CSIT 121 Spring’05 Division rules Operator precedence rules Lab Exercise.
Java vs. You.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Java Programming Practice.
Computer Programming Lab(5).
Warm-Up: Monday, March 3 List all devices you can think of that can be used to input information into the computer.
Introduction to Information and Computer Science Computer Programming Lecture c This material (Comp4_Unit5c), was developed by Oregon Health and Science.
PYTHON PROGRAMMING Week 10 – Wednesday. TERMS – CHAPTER 1 Write down definitions for these terms:  Computation  Computability  Computing  Artificial.
CSC 386 – Computer Security Scott Heggen. Database Security How can we minimize the probability of success by attacks like the one shown in the comic?
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Looping Exercises Deciding Which Loop to Use At this.
EXERCISE IN CLASS CHAPTER 2. PART 1 SEQUENCE SCENARIO 1 Write an algorithm for a C program, that prompts user to enter total number of umbrellas he/she.
Component 4: Introduction to Information and Computer Science Unit 5: Overview of Programming Languages, Including Basic Programming Concepts Lecture 3.
Computer Programming 12 Mr. Jean March 5 th, 2014.
CPSC 233 Tutorial 5 February 2 th /3 th, Java Loop Statements A portion of a program that repeats a statement or a group of statements is called.
Homework #4: Operator Overloading and Strings By J. H. Wang May 22, 2015.
CS305j Introduction to Computing Parameters Case Study 1 Topic 10 Parameters Case Study " Thinking like a computer scientist means more than being able.
Loops Review. How to generate random numbers Math.random() will return a random decimal value in the form of a double. double num1 = Math.random(); num1.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
Introduction to programming in java
Exercise 1- I/O Write a Java program to input a value for mile and convert it to kilogram. 1 mile = 1.6 kg. import java.util.Scanner; public class MileToKg.
Exercise : Write a program that print the final price of purchase at a store where everything costs exactly one dollar. Ask for the number of items purchased.
Chapter 3: Variables, Functions, Math, and Strings
Chapter 3: Variables, Functions, Math, and Strings
Arrays (in Small Basic)
Section 64 – Manipulating Data Using Methods – Java Swing
LESSON 3.
C++ Arrays.
COMP 274 Innovative Education--snaptutorial.com
INPUT STATEMENTS GC 201.
Python I/O.
Use proper case (ie Caps for the beginnings of words)
Introduction to pseudocode
Tonga Institute of Higher Education
More Loops.
More Loops.
Chapter 1: Introduction
75 Has 7 in the tens place Odd Number Less than 100
For Wednesday No new reading No quiz.
Chapter 6-2 (Book Chapter 8)
Exercise 1 Declare a constant of type int called SIZE and initialize it to value 10 Declare two int arrays of size “SIZE” Assume that those int arrays.
Chapter 5 Loops Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved.
Chapter 6-2 (Book Chapter 8)
Exercise 2 Main Module Declare Integer dollars String message
Recursion Chapter 11.
Bills Exercise Main Module Declare Integer dollars
int [] scores = new int [10];
Review for Test1.
Life is Full of Alternatives
Recursion Chapter 11.
Programming Control Structures
Chapter 5 Processing Input with Applets
Using Script Files and Managing Data
12 Has 1 in the tens place Even Number Less than 20
LOOPS The loop is the control structure we use to specify that a statement or group of statements is to be repeatedly executed. Java provides three kinds.
int [] scores = new int [10];
Dry Run Fix it Write a program
Algorithms For use in Unit 2 Exam.
Array Fundamentals A simple example program will serve to introduce arrays. This program, REPLAY, creates an array of four integers representing the ages.
Sequential Programming
H446 Computer Science.
Presentation transcript:

Chapter 1 Introduction to Java

Exercise 1- I/O Write a Java program to input a value for mile and convert it to kilogram. 1 mile = 1.6 kg.

Exercise 2 - Condition Write a Java program that asks user to input the weight of a package and compute the shipping cost based on the following function: If the weight is more than 20kg, display a message that “the package cannot be shipped.”

Exercise 3 - Iteration Write a Java program to compute the factorial of a number input by the user.

Exercise 4 - Array Enter numbers: 1 2 3 2 1 6 3 4 5 3 Write a Java program that reads ten integers and store the numbers in an array. Then compute and display the number of even numbers and odd numbers. Assume that the input ends with 0. Here is the sample run of the program: Enter numbers: 1 2 3 2 1 6 3 4 5 3 The number of odd numbers: 6 The number of even numbers: 4