Java Programming with BlueJ Objectives

Slides:



Advertisements
Similar presentations
Introduction to Programming Java Lab 1: My First Program 11 January JavaLab1.ppt Ping Brennan
Advertisements

Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Scite Scintilla integrated text editor. Click here.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Introduction to Java. Main() Main method is where the program execution begins. There is only one main Displaying the results: System.out.println (“Hi.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Objects Real and Java COMP.
A First Program Using C#
Microsoft Visual Basic 2005: Reloaded Second Edition
Java Programming, 3e Concepts and Techniques Chapter 2 - Part 2 Creating a Java Application and Applet.
1 v1.6 08/02/2006 Overview of Eclipse Lectures 1.Overview 2.Installing and Running 3.Building and Running Java Classes 4.Refactoring 5.Debugging 6.Testing.
CSI 1390: Introduction to Computers TA: Tapu Kumar Ghose Office: STE 5014
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
1 Classes and Controls CE-105 Spring 2007 By: Engr. Faisal ur Rehman.
Hello World in the Forte IDE An introduction to the Forte IDE (integrated development environment) writing the classic “Hello World” program in Java.
EIE375 BlueJ: Getting Started Dr Lawrence Cheung.
Applications Development
JAVA Practical Creating our first program 2. Source code file 3. Class file 4. Understanding the different parts of our program 5. Escape characters.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6: Transition to Java Programming with Alice and Java First Edition.
Lab 01-2 Objectives:  Writing a Java program.  How to send output to the command line console.  Learn about escape sequences.  Learn how to compile,
1 Chapter 3 – JavaScript Outline Introduction Flowcharts Control Structures if Selection Structure if/else Selection Structure while Repetition Structure.
Object Oriented Programming (OOP) LAB # 1 TA. Maram & TA. Mubaraka TA. Kholood & TA. Aamal.
Compiling and running Java programs with BlueJ. Successfully compiled files program files in BlueJ You can tell from the shade of a program icon in BlueJ.
1 Class 1 Lecture Topic Concepts, Definitions and Examples.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
1.1: Objects and Classes msklug.weebly.com. Agenda: Attendance Let’s get started What is Java? Work Time.
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
Introduction to Programming Python Lab 7: if Statement 19 February PythonLab7 lecture slides.ppt Ping Brennan
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
Last Revision. Question1 Novice Java programmers often write code similar to, class C { public int x;... }... C[] a = new C[10]; for(int i = 0; i < a.length;
Author: Loh Jianxiong Christopher Contributions: Chua Jie Sheng, Li Mengran, Peh Shao Hong, Oo Theong Siang, Tong Chun Kit, Tania Chattopadhyay.
GUI’s.
Objects Real and Java COMP T1 3
The eclipse IDE IDE = “Integrated Development Environment”
Introduction to Programming
Introduction to Programming
Chapter 1: An Introduction to Visual Basic 2015
Yanal Alahmad Java Workshop Yanal Alahmad
Testing and Debugging.
Computer Programming I
Introduction to Programming
Introduction to Programming
Introduction to Flowcharting
While Loops Chapter 3.
Agenda Warmup Lesson 2.5 (Ascii, Method Overloading)
CS139 – Fall 2010 How far we have come
Java Programming with BlueJ
Java Fix a program that has if Online time for Monday’s Program
Introduction to Programming
CIS16 Application Development Programming with Visual Basic
How to Run a Java Program
محاضرة 1: مقدمة للمسـاق و مراجعـة للأساسيـات
Introduction to Programming
Implementing Classes Chapter 3.
Java Intro.
CS110D Programming Language I
Java Fix a program that has if Online time for Monday’s Program
Introduction to Programming
Tonga Institute of Higher Education
Programming in JavaScript
Programming in JavaScript
Introduction to Object-Oriented Programming
Java Looking at our first console application in Eclipse
Running a Java Program using Blue Jay.
Introduction to Programming
Introduction to Programming
Introduction to Flowcharting
Introduction to Programming
The Python interpreter
Presentation transcript:

Java Programming with BlueJ Objectives After this presentation you should be able to : Open a BlueJ project (or start a new project) Create a new class Edit default code Create Java source code for each of the structures: Sequence Selection Repetition

Java Programming with BlueJ Opening a new project Click Project New Project Select YOUR C: drive

Java Programming with BlueJ Creating a folder for projects Click New Folder Name Folder: BlueJ Projects Name Project: Structures

Java Programming with BlueJ Your window should look like this

Java Programming with BlueJ Creating a new class Click New Class Name Class: Student Select Class Button Click OK

Java Programming with BlueJ Your window should look like this The diagonal bars indicate a class that has errors or has not been compiled.

Java Programming with BlueJ Editing the code Right click the class Select Open Editor You will see these features provided for you. Private attribute Default constructor A method

Converting pseudo code to Java Sequence Statements Construct a segment of code that will display the text “Hello World” and “I am a student at AACC”. Pseudo Code Java Code print “Hello World” System.out.println(“Hello World”); print “I am a student at AACC” System.out.println(“I am a student at AACC”);

Java Programming with BlueJ Adding your own code – Sequence Structure Convert the sampleMethod to MyMethod shown here To output of this code

Java Programming with BlueJ Compiling the code Click Compile from either window. The diagonal lines in the Student class should disappear. ‘no syntax errors’ should appear in the box below.

Java Programming with BlueJ Instantiating the class Right click the Student Class. Select new Student( ) Accept the default name. Click OK An instance of the Student class appears on the object bench

Java Programming with BlueJ Running the code inherited from Object void MyMethod( ) Inspect Remove Right Click the student1 object Select MyMethod()

Java Programming with BlueJ Your output window should look like this The output from the System.out.println statements appear in a Terminal Window for the Structures project. Review the code that got us here.

Java Programming with BlueJ Editing the constructor and adding an instance variable. Add the attribute grade (an integer). Edit the constructor to include the parameter newGrade and the assignment statement. To the execution of the constructor

Converting pseudo code to Java Selection Statements Write a segment of code that will convert a letter grade to an A or B. Pseudo Code Java Source Code if grade >= 90 then if (grade>= 90) print “A” System.out.println(“A”); else else print “B” System.out.println(“B”); end if

Java Programming with BlueJ Adding another method – selection structure. Add another method called method2. method2 has no parameters and no local variables. method2 contains a multi-way selection structure. Compile the code. Show output from this structure.

Java Programming with BlueJ Running the new code. Right click the Student class. Select new Student() A new window appears because the constructor now expects a parameter. Input an integer value, click OK. Review the code that got us here.

Java Programming with BlueJ Running the new code. Right click the object. Select method2( ) inherited from Object void MyMethod( ) void method2( ) Inspect Remove

Java Programming with BlueJ Your output window should look like this The output from the System.out.println statement appears in a Terminal Window for the Structures project. Review the code that got us here.

Converting pseudo code to Java Repetition Statements Construct a loop that will display the numbers 1 – 10. Pseudo Code Java Code for x = 1 to 10 for (x = 1; x <= 10; x++) print x System.out.println(x); end for

Java Programming with BlueJ Adding another method – repetition structure. Add another method called method3. method3 has no parameters and no local variables. method3 contains a for loop (repetition structure). Compile the code. Show output from this structure.

Java Programming with BlueJ Running the new code. Right click the object. Select method3( ) inherited from Object void MyMethod( ) void method2( ) void method3( ) Inspect Remove

Java Programming with BlueJ Your output window should look like this The output from the System.out.println statements appears in a Terminal Window for the Structures project. Review the code that got us here.

Java Programming with BlueJ Assignments Work on assignments given by your instructor.