Java Programming, 3e Concepts and Techniques Chapter 3 Section 62 – Manipulating Data Using Methods – Day 1.

Slides:



Advertisements
Similar presentations
Java Programming, 3e Concepts and Techniques Chapter 3 Section 63 – Manipulating Data Using Methods – Day 2.
Advertisements

© The McGraw-Hill Companies, 2006 Chapter 15. © The McGraw-Hill Companies, 2006 Exceptions an exception is an event that occurs during the life of a program.
The Web Warrior Guide to Web Design Technologies
Chapter 10 Introduction to Arrays
 2005 Pearson Education, Inc. All rights reserved Introduction.
Starting Out with C++, 3 rd Edition 1 Chapter 1. Introduction to Computers and Programming.
Java Programming, 3e Concepts and Techniques Chapter 4 Decision Making and Repetition with Reusable Objects.
Java Programming, 3e Concepts and Techniques Chapter 5 Arrays, Loops, and Layout Managers Using External Classes.
Using Visual Basic 6.0 to Create Web-Based Database Applications
03 Data types1June Data types CE : Fundamental Programming Techniques.
Java Programming, 3e Concepts and Techniques Chapter 3 Manipulating Data Using Methods.
Introduction to Computers and Programming Lecture 3: Variables and Input Professor: Evan Korth New York University.
Tutorial 10 Programming with JavaScript
Java Programming, 3e Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Review CSC 171 FALL 2004 LECTURE 21. Topics Objects and Classes Fundamental Types Graphics and Applets Decisions Iteration Designing Classes Testing and.
Chapter 7 Improving the User Interface
1 Class 8. 2 Chapter Objectives Use Swing components to build the GUI for a Swing program Implement an ActionListener to handle events Add interface components.
Chapter 6: Graphical User Interface (GUI) and Object-Oriented Design (OOD) J ava P rogramming: Program Design Including Data Structures Program Design.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
V Avon High School Tech Club Agenda Old Business –Delete Files New Business –Week 16 Topics: Intro to HTML/CSS –Questions? Tech Club Forums.
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
Java Programming, 3e Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
A First Program Using C#
Introduction to Information and Computer Science Computer Programming Lecture c This material (Comp4_Unit5c), was developed by Oregon Health and Science.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Java Programming, 2E Introductory Concepts and Techniques Chapter 3 Manipulating Data Using Methods.
Java Programming, 3e Concepts and Techniques Chapter 2 - Part 2 Creating a Java Application and Applet.
Programming with JavaScript (Chapter 10). XP Various things Midterm grades: Friday Winter Career Fair – Thursday, April 28, 2011 (11 am to 3 pm). – MAC.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
Tutorial C#. PLAN I. Introduction II. Example of C# program :Hello World III. How to use C# language GUI elements Primitives Types Expressions and operators.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Tutorial 10 Programming with JavaScript. XP Objectives Learn the history of JavaScript Create a script element Understand basic JavaScript syntax Write.
Tutorial 10 Programming with JavaScript
Java Programming: From Problem Analysis to Program Design, 3e Chapter 3 Introduction to Objects and Input/Output.
Beginning C++ Through Game Programming, Second Edition
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Using Data Within a Program Chapter 2.  Classes  Methods  Statements  Modifiers  Identifiers.
CSci 111 – computer Science I Fall 2014 Cynthia Zickos WRITING A SIMPLE PROGRAM IN JAVA.
1.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
8-1 Compilers Compiler A program that translates a high-level language program into machine code High-level languages provide a richer set of instructions.
Java Programming: From Problem Analysis to Program Design, 3e Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Java Programming, 2E Introductory Concepts and Techniques Chapter 4 Decision Making and Repetition with Reusable Objects.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 3 Introduction to Objects and Input/Output.
Java Programming: From Problem Analysis to Program Design, Second Edition1 Lecture 5 Objectives  Learn about basic GUI components.  Explore how the GUI.
Component 4: Introduction to Information and Computer Science Unit 5: Overview of Programming Languages, Including Basic Programming Concepts Lecture 3.
1 Class 6. 2 Objectives Objectives Identify, declare, and use primitive data types Use the System class to create data streams Use the Scanner class of.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Ten Structures and Sequential Access Files.
Creating a Java Application and Applet
Chapter 9: Completing the Basics. In this chapter, you will learn about: – Exception handling – Exceptions and file checking – The string class – Character.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Introduction Chapter 1 1/22/16. Check zyBooks Completion Click on the boxes for each section.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
What is O.S Introduction to an Operating System OS Done by: Hani Al-Mohair.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
CGS 3066: Web Programming and Design Spring 2016 Introduction to JavaScript.
JavaScript and AJAX 2nd Edition Tutorial 1 Programming with JavaScript.
Java Programming, 3e Concepts and Techniques Chapter 1 Section 56 – An Introduction to Java.
Chapter 6 Testing and running a solution. Errors X Three types Syntax Logic Run-time.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
Chapter 7 Text Input/Output Objectives
Section 64 – Manipulating Data Using Methods – Java Swing
Java Programming: From Problem Analysis to Program Design,
An Introduction to Visual Basic .NET and Program Design
INPUT STATEMENTS GC 201.
Java for Teachers Intermediate
Chapter 15: GUI Applications & Event-Driven Programming
Introduction to Data Structure
Presentation transcript:

Java Programming, 3e Concepts and Techniques Chapter 3 Section 62 – Manipulating Data Using Methods – Day 1

Chapter 3: Manipulating Data Using Methods 2 Objectives Understand the different ways to get input in Java (console application in a command prompt window, console application with dialog boxes and applets) Identify, declare, and use primitive data types Set up a new project for calculating body mass index

Chapter 3: Manipulating Data Using Methods 3 Introduction Data are collections of raw facts or figures A program performs operations on input data to output information Input data can come from a variety of sources –The program itself –Users of the program –External files

Chapter 3: Manipulating Data Using Methods 4 The Body Mass Index Calculator An interactive program –Accepts the weight and height from the user –Calculates the BMI to gauge total body fat –Displays the result Three versions –Input/Output using the command prompt –Input/Output using dialog boxes –Web environments use an applet interface

Chapter 3: Manipulating Data Using Methods 5 (b) console application using dialog boxes (a) console application in a command prompt window (c) applet

Chapter 3: Manipulating Data Using Methods 6

7 Problem Analysis Convert user input to metric measurements Calculate the BMI Display the result

Chapter 3: Manipulating Data Using Methods 8 Design the Solution Design the three kinds of user interfaces with storyboards Design the logic of the program –Use pseudocode for sequential flow for all programs –Use an event diagram for the applet Validate the design –Compare the program design with the original requirements

Chapter 3: Manipulating Data Using Methods 9 Storyboards

Chapter 3: Manipulating Data Using Methods 10

Chapter 3: Manipulating Data Using Methods 11 Coding the Program Import the java.io package –Provides classes to support system input and output Add a throws IOException clause to the method header –Warns the compiler that the possibility of input or output errors exists –Gives the program the opportunity to handle input or output errors during run-time without aborting

Chapter 3: Manipulating Data Using Methods 12 Set up a new project in NetBeans Open NetBeans Create a new project called BodyMassCalculator Choose Java>Java Application Set the Main Class to bodymasscalculator.BodyMass

Chapter 3: Manipulating Data Using Methods 13 Coding the Program Add the java.io.* library Add “throws IOException”

Chapter 3: Manipulating Data Using Methods 14 Storing Data Java is a strongly typed language –Variables must be declared with a data type –Variable locations can hold only that data type Java has two categories of data types –Primitive data types hold single data items Integers, characters, floating point, and booleans are primitive types –Reference data types hold a value that refers to the location of the data All Objects and arrays are reference types

Chapter 3: Manipulating Data Using Methods 15

Chapter 3: Manipulating Data Using Methods 16 Declaring Variables

Chapter 3: Manipulating Data Using Methods 17 Declare the Variables You Need Add variable declarations

Chapter 3: Manipulating Data Using Methods 18 Summary Variables are simply places to store information –Variables can only store one type of data There are different ways to get input from the user

Chapter 3: Manipulating Data Using Methods 19 Rest of Today Make sure you have created the BodyMassCalculator class and added the variables you will need.