+ All Categories
Home > Documents > JavaFundamentals Section1

JavaFundamentals Section1

Date post: 02-Jun-2018
Category:
Upload: kurodokoljenko
View: 222 times
Download: 0 times
Share this document with a friend
48
Java Fundamentals 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Transcript
Page 1: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 1/48

Java Fundamentals

1 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 2: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 2/48

Introduction

Overview

This lesson covers the following topics:

• Describe the purpose for using Alice 3 and Greenfoot

 

• Describe the skills used to generate an animation or

create a game

• Describe the components of a team project

• Create a teamwork assessment rubric• Describe the purpose for creating a journal to document

programming projects

2 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

• escr e e co e o e cs an cy er secur y

Page 3: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 3/48

Introduction

What is an Animation?

 An animation is a series of independent movements that

when viewed rapidly, one-after-another, creates the

Using Alice 3 you can create animations with 3D objects

that move and act.

Because Alice 3 lets the programmer manipulate objects, it is

considered object-oriented programming (“OOP”).

3 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 4: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 4/48

Introduction

3D Objects

 Alice 3 uses three-dimensional (“3D”) objects that a

programmer can drag-and-drop into a scene to create a

 A 3D object is one with width, height, and depth.

4 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 5: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 5/48

Introduction

Virtual World

You will use Alice 3, and your imagination, to create a

virtual world. Your virtual world will contain the following

• Settings: objects that will remain stationary in your

animation (a tree, rocks, or a building).

• Actors: objects that will move in your animation (people,

animals, or vehicles).

• ac groun emp a e: a ac groun on o w c you

place both setting and actor objects.

5 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

 

imaginary physical environment.

Page 6: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 6/48

Introduction

3D World Example

Here is an example of a 3D world. A 3D world is referred

to as a “virtual world.” The example virtual world has both

template.

Setting Object

Background

emp a e

 Actor Object

6 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 7: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 7/48

Introduction

Steps to Launch Alice 3

1. Locate the Alice 3 icon on your desktop.

2. Double click the icon to launch the application.

.   .

7 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 8: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 8/48

Introduction

Steps to Locate the Example Animation File

1. From the dialog box, select the File System tab.

2. Click the Browse button.

“ ”.   .

saved it in on your computer.‡

4. Click the Open button from the dialog box.. c e u on rom e a og ox.

‡ The scenario example must first be downloaded from the videospage for this lesson in Oracle iLearning. Remember the location the

file has been saved to. If you are unable to run the Alice file due to an

issue with your version of Alice, watch the corresponding video.

8 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 9: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 9/48

Introduction

Run the Animation

To run an animation, click the Run button in the world

window.

9 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 10: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 10/48

Introduction

Greenfoot

 An interactive game is one that involves human

interactions, decisions, and actions. Using Greenfoot, you

interactive game.

ecause reen oo e s e programmer man pu a e o ec s, s

considered object-oriented programming (“OOP”).

10 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 11: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 11/48

Introduction

Greenfoot Interface

Greenfoot uses two-dimensional (“2D”) objects that the

programmer can drag-and-drop into a scene to create a

11 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 12: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 12/48

Introduction

High-level Steps to Play a Greenfoot Game

1. Launch Greenfoot.

2. Open the game file.

.   .

4. Play the game.

12 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 13: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 13/48

Introduction

Steps to Launch Greenfoot

1. Locate the Greenfoot icon on your desktop.

2. Double click the Greenfoot icon to launch the program.

13 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 14: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 14/48

Introduction

Steps to Open the Greenfoot Game File

1. Download the flying_frog example from the lesson’s Videos page

in Oracle iLearning. Save the file to a location on your computeror hard drive.

2. From the Scenario Menu in Greenfoot, select Open. †

3. Search for and select the flying_frog file.

.   .

display.

  s s e rs me reen oo s aunc e on your mac ne, you

may be prompted for a decision. Select Scenario – Open from the

menu.

14 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 15: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 15/48

Introduction

Steps to Set Up the Game’s Objects

1. Place objects in the world that will interact in the game.

 A. Click once on the Frog class.B. Hold the Shift key down on your keyboard while you click and hold

the Frog class.

C. Drag the Frog object onto the World.

2. Repeat step 1 to add objects from the Fly class.

15 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 16: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 16/48

Introduction

Steps to Play the Game

1. Click the Run button.

2. Steer the Frog using your keyboard’s arrow keys.

.  

4.  Add more flies to the game to make it more interesting.

16 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 17: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 17/48

Introduction

Greenfoot Objects

Look around you. Undoubtedly, you will see many objects.

Your classmates are even objects!

,

world that contains objects. The objects have states

(descriptors) and behaviors (actions).

• Example: Classmate

 – States can include: Name, ethnicity, and hair color 

 – , , .

 All objects have two characteristics: states and behavior.

17 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 18: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 18/48

Introduction

Greenfoot Classes

Every object is created from a class. A class is a set of

instructions for an object. An example of a class is Bicycle.

bicycle objects within that class.

 

created from that class will follow.

Wheels = 2

Color= Red

=

18 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

 

Page 19: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 19/48

Introduction

Greenfoot Objects and Classes Example

Here is an example of a Greenfoot world with objects.

The Frog and Fly objects are subclasses of the Animal

ObjectClasses

Object

19 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 20: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 20/48

Introduction

Why Learn These Programs?

Now that you've had a chance to install and run Alice 3

and Greenfoot, do you have any ideas about why these

How can Alice 3 and Greenfoot help you learn

programming concepts and how to program in Java?

20 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 21: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 21/48

Introduction

Why Learn Alice 3?

 Alice 3 offers a good introduction to learning how to

program for many reasons:

“ 

forward” or “turn left” rather than obscure programming

syntax.

• You drag and drop objects on the screen and press

“Run” to run your animation rather than using the

.• When you make a mistake in Alice 3, it is usually

obvious how to fix it. In programming languages, it is

21 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

often difficult to interpret error messages.

Page 22: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 22/48

Introduction

Why Learn Alice 3? (cont.)

 Alice 3 offers a good introduction to learning how to

program for many reasons:

  ,

director.

• Alice 3 allows you to learn fundamental programming

concepts in the context of creating animated movies and

simple video games.

• y man pu a ng e o ec s n a v r ua wor , you cangain experience with many of the programming

constructs typically taught in an introductory

22 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

programming course.

Page 23: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 23/48

Introduction

Why Learn Alice 3? (cont.)

 Alice 3 offers a good introduction to learning how to

program for many reasons:

 

23 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 24: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 24/48

Introduction

Why Learn Greenfoot?

Greenfoot is a good introduction to programming for

several reasons:

 

orientation which makes developing desktop Java

applications easier than starting from scratch.

• It's interface is an interactive development environment

(IDE) that allows you to edit source code, compile, and

', .

24 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 25: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 25/48

Introduction

Skills Needed to Generate Animations andGames

 Alice 3 and Greenfoot will help you learn to program in

Java. In order to use Alice 3 and Greenfoot to create

25 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 26: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 26/48

Introduction

Steps to Create an Animation or Game

1. Define a scenario.

 A. What story is to be told?B. What objects are needed?

C. What actions will take place?

2. Design the storyboard for the scenario.

 A. Visual, textual, or both.

3. Create the animation in Alice 3 or game in Greenfoot.

4. Test the animation or game.

26 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 27: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 27/48

Page 28: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 28/48

Introduction

Parts of a Scenario

 A scenario contains three parts:

• Story: The story to tell, or game to play. For example, a

.

• Objects: The objects you will use in your story. For

example, a frog and flies.

• Actions: All the actions the objects will take.

 – For example: The frog will fly using arrow keys while the

es move a ou ran om y. en e rog ouc es a y, efly is removed from the screen.

28 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 29: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 29/48

Introduction

Scenario Example

Scenario Element Description

Story  .

and says hello back.

Two children (two males, or one male and one female)

and two trees.

 Actions

Boy looks at his friend and says, “Hello.”

r en says e o an waves ac a m.

ResultUsing Alice 3, we have told a simple story about two

friends greeting each other.

29 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 30: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 30/48

Introduction

Components of a Team Project

Teamwork is a skill that is needed in the 21st century

workplace.

Throughout this course, you will work on projects and

assignments in teams.

30 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 31: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 31/48

Introduction

Components of a Team Project (cont.)

 As a team, your success is dependent on many things

including:

 

• Shared responsibility

•  

• Regular meetings

• Clear roles• Clear and defined tasks

31 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 32: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 32/48

Introduction

Standards for Team Success

Imagine this:

• Your team has begun work on an animation project and

scenario.

• After hours of thinking and writing, you have created thescenario and are ready to present it to your team.

How will you know if your work will meet the expectations

of your teammates, and be well received?

32 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Page 33: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 33/48

Introduction

Use a Rubric to Define Team Success

To ensure success, a team will define a rubric to assess

how the team performed.

 

matches the rubric criteria.

• The team and its individual members will review therubric for evaluation and reflection.

- project assessment. If followed, the rubric will aid in meeting the

team's criteria for success.

33 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

I t d ti

Page 34: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 34/48

Introduction

Team Assessment Rubric Example

4 (Highest) 3 2 1 (Lowest)Contributions

 Always… Usually… Sometimes… Rarely…

Problem

Solving  Always… Usually… Sometimes… Rarely…

 Attitude Always… Usually… Sometimes… Rarely…

34 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

I t d ti

Page 35: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 35/48

Introduction

Journal

Journaling is a learning tool most commonly used in

writing and history classes. It can also be very helpful

For example, you can use a software journal to:

• Summarize new concepts.

• Track changes and discoveries.

• Solve problems.

• Consider varying perspectives.

35 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

• Track ideas for future implementation.

I t d ti

Page 36: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 36/48

Introduction

Read Past Journal Entries

One of the best things about using a journal in a

programming class is that you can read past journal

36 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

I t d ti

Page 37: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 37/48

Introduction

Journal Cookbook

In this course, your journal will take the form of a

“cookbook.”

You will add “recipes” to your “cookbook” as you learn

new concepts and code.

• Keep a recipe for each lesson or new concept.

• Make your recipes easy to follow by others.

• Use the recipes as your main study guide for the AP or

Oracle Certification Exam.

37 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Introduction

Page 38: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 38/48

Introduction

Journal Components

Your journal “cookbook” must be kept current and will

include:

 

• Recipe titles

•  

• Important objectives and vocabulary

• Ste s to re roduce

38 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Introduction

Page 39: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 39/48

Introduction

Code of Ethics

You are a member of society.

• As a member, you are expected to follow certain rules,,

unacceptable.

• All societies rely on its citizens to abide by ethics, ormoral principals.

• Cyber ethics is a code of behavior for using the Internet.

39 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Introduction

Page 40: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 40/48

Introduction

Cyber Ethics Do’s and Don’ts

Do Don’tDo use the Internet to help you do your Don't copy information from the Internet

schoolwork. and call it your own.

Do use the Internet to learn about music,

video and games.

Don't use the Internet to download or

share copyrighted material.' 

friends and family. with strangers.

Don't pretend to be someone else.

Don't be rude or use bad language.

Don't give anyone personal information

40 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

  .

Introduction

Page 41: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 41/48

Introduction

IEEE Code of Ethics

The Institute of Electrical and Electronics Engineers

(IEEE): 

technology and innovation.

• Publishes the IEEE Code of Ethics, a commitment to thehighest ethical and professional conduct.

41 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Introduction

Page 42: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 42/48

Introduction

IEEE Code of Ethics Summary

Summary of the IEEE Code of Ethics:

• Accept responsibility for decisions.

• ga e con c s o n eres .e., corrup on .

• Be honest.

  .

• Continuously improve one's work.

• '  .• Treat everyone fairly and with respect.

• Never cause harm to our eers rather assist and

42 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

support them.

Introduction

Page 43: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 43/48

Introduction

Computer Viruses

 A computer virus is a form of a cyber attack, a method

used to gain control of another computer, or group or

attacks are:

• Identity theft• Spamming

• System infiltration

 A computer virus is a program created by an unethical individual

or group of individuals with the sole intent of damaging as many

43 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

  .

Introduction

Page 44: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 44/48

Introduction

Cyber Attacks and Cyber Security

Most computers prevent cyber attacks by using virus

scanning software.

Large organizations (even governments) rely on cyber

security teams to define processes that will avoid a cyberattack.

44 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Introduction

Page 45: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 45/48

Introduction

Cyber Security Practices

Examples of cyber security practices:

• Don't share passwords.

• eep an -v rus so ware up- o- a e.

• Only open emails from trusted sources.

  ,

name) on websites, including social media sites.

Cyber security is the establishment of processes with the sole

objective of mitigating cyber attacks.

45 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

Introduction

Page 46: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 46/48

Introduction

Terminology

Key terms used in this lesson included:

• Object-oriented programming

•   mens ona an mens ona

• Virtual world

• Behavior 

•• Rubric

• C ber ethics

46 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

• Cyber security

Introduction

Page 47: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 47/48

Introduction

Summary

In this lesson, you should have learned how to:

• Describe the purpose for using Alice 3 and Greenfoot 

• Describe the skills used to generate an animation or

create a game

• Describe the components of a team project

• Create a teamwork assessment rubric

• Describe the purpose for creating a journal to document

programming projects

47 Copyright © 2012, Oracle and/or its affiliates. All rights

reserved.

• escr e e co e o e cs an cy er secur y

Introduction

Page 48: JavaFundamentals Section1

8/10/2019 JavaFundamentals Section1

http://slidepdf.com/reader/full/javafundamentals-section1 48/48

Introduction

Practice

The exercises for this lesson cover the following topics:

• Playing a sample game in Greenfoot

• en y ng o ec s, s a es an e av ors

• Creating a scenario

 

• Reviewing IEEE code of ethics and relate to school

rou ro ects• Discussing cyber security and its impact to your country


Recommended