Java Programming 1

weaverchurchΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 5 χρόνια και 2 μήνες)

433 εμφανίσεις


ITP 120
-
002W Java I Programming

(4 Semester Credit Hours)

Wednesday Evenings 1800
-
2150 Hours

Northern Virginia Community College

Woodbridge Campus

Fall

2012


Instructor: Patrick J. Healy, Assistant Professor, IT

Office Hours:

1700
-
1800 hours
,
Room

302
-
J

Contact Info (Phone): (703) 878
-
5648 (Desk & Voice Mail)

E
-
Mail:
phealy@nvcc.edu



You will need two (2) USB flash drives for this course.


Textbook
:

Introduction to Java

Programming
-
Comprehensive, 9
th Edition
,

ISBN
13:978
-
0
-
13
-
293652
-
1 (2012) by
Y. Daniel Liang
,

can be purchased from the
Woodbridge Campus bookstore. You may also visit:
www.pearsonhighered.com/liang





Course Description

This course
provides instruction in the fundamentals of an object
-
oriented programming language using Java. This course emphasizes software and
algorithm development an
d coding, testing and debugging of Java programs to include
graphic
al user interfaces (GUIs).


Lecture: 4 hours per week.


General Course Purpose

This course provides a comprehensive foundation sufficient for a student to write Java
programs from scratch in order to meet the minimum programming goals of students who
plan to transfer and students who take the course for employment purposes
.


Course Prerequisites/Co
-
requisites


ITP 100 (Software Design)

or the equivalent, or
some programming experience. Students are also expected to know how to install
software on a PC, how to send and receive email, and to have a ready access to an email
account. You may use your NVCC e
-
mail account or your personal e
mail account.


Course Objectives


Upon completion of th
is

course
,

the student will be able to:

Design, develop, code, and test Java Programs both console applications and GUI
applications
.

Use primitive data types and flow control statements that are
the building
blocks of all programming.



2

Course Objectives

(continued)

Use their foundation knowledge of object oriented coding techniques to create classes
that are applied appropriately in a Java Program as a solution to a specific problem
statement
.

Sp
ecific
Course
Objectives



Develop, code, test and debug

Java application

programs



Use sequence, looping and decision control structures in Java programs



Define
,

use
, and call
methods in Java programs



Use
single and multidimensional
array processing
techniques in Java



Create and use strings and string methods in Java



Design and implement class hierarchies using inheritance and composition



Handle program exceptions and be familiar with text input and output



Define and use abstract classes and interfac
es in Java programs



Create and use graphical user interface (GUI) components

in Java programs



Process keyboard, mouse and window events in Java

programs



Create and use recursive methods

in Java programs


Common Course

Content




Primitive data types



Input an
d Output



Selection Statements and Looping



Methods



Arrays



Classes and Objects



Strings



Files



Inheritance



GUI

Programs


Student Learning Outcomes

and
Required
Time Allocation Perc
en
tages


See

pages
6


9
in

this syllabus.



Course Withdrawal Policy

Students failing to attend the first two class meetings (i.e.
the first two weeks) will be automatically dropped from the course. You may voluntarily
withdraw from the course and receive a grade of “W”, no later than

Oct

3
1
, 201
2

After
this date you will
receive an “F” since it is your responsibility to withdraw.




3

Contact Information

You may email me at
phealy@nvcc.edu

Please include “
ITP
120
” in the subject matter, to avoid your e
-
mail being confused with spam email. I will
try to respond to your e
-
ma
ils within 24 hours.
Please do NOT involve me in


lengthy
software debugging sessions via e
-
mail
.
This is often difficult and very time
consuming.

I will try to help you before class and during break periods in class.

Other Course Materia
ls

I often post

class notes, program code, lecture slides, and
related material
on

the class web site.

Java code is also posted on Blackboard.

You are
responsible for printing your own copies


hard copies will not be handed out in class.
Please visit the class web site

at the URL

http://www.nvcc.edu/home/phealy/itp120

to
print your copies, since some updates might not be added until the day before or the day
of the Java class.


Solutions
Link
to Review Questions

http://www.cs.armstrong.edu/liang/intro9e/studentsolution.html


Java Software

Oracle’s System Development Kit (JDK)

Java SE 7

Update
5


(JSE,
Standard Edition for Windows

32
-
bit
)
or later, and the included Java Runtime
Environment (JRE) are required to be installed on your PC to be able to compile and run
your Java programs. (See the instructions in this syllabus for downloading Java)


Be sure to download the Java System Developme
nt Kit (JDK ) for Windows !!!

You may visit Web site
http://www.oracle.com/technetwork/java/index.html


and download the latest Standard Edition of the JDK. You may install this software onto
your PC.
You may also use TextPad as an IDE. Download it from
www.TextPad.com

A
nother

free IDE:

NetBeans

from

http://netbeans.org/downloads/index.html

Free Java compilers:
JCreator
(
www.jcreator.com
) JGrasp:
http://www.jgrasp.o
rg/

Go to
www.Eclipse.org

to
download a copy of Eclipse.
A very good text editor: Notepad++ Visit:
http://PortableApps.com

for many other tools such as FileZilla.


Late
Assignments

Assignments are due at the beginning of class on the due date. Late
assignments will be penalized; you will
lose 25%

of the grade for the assignment per
class missed. As you may not be able to complete class exercises and projects during
regul
ar class, you will need to have access to a computer outside of class where you can
complete your projects and assignments. Problems with lab computers will not be
accepted as excuses.
Do NOT expect to turn in late work just before the final exam
.


Attenda
nce Policy

Attendance records will be taken; students are responsible for
covering all work missed and submitting assignments at the scheduled times. Students are
expected to take the required examinations at the scheduled times only. Please contact
me as

soon as possible in the event of emergencies such as illness, unscheduled and
unavoidable travel, military deployment etc. I will
NOT

leave any make
-
up exams such
as the midterm or final in the NVCC
-
Woodbridge Testing Center, Room 436.

In this course, yo
u should plan to spend much more than one day per week on Java !



4

Grading Policy

Grading will be based on programming projects, quizzes, a midterm
examination, and a final examination. These will be weighted as follows as percentages
of the total course gr
ade:
About 2
6
00 points in the course;

about

1
2

Assignments

Assignments: 60% Midterm Exam:
1
5
%
NVCC Common
Final Exam:

25
%

Grading system: (A = 90
-
100, B=80
-
89, C=70
-
79 etc.).

Exams will be closed book,
and closed notes.


Programming assignments are individual assignments, you may consult any reference
material, or ask general hints, explanation of concepts, and pointers from any one
including your classmates, but you must provide your own solutions and write your own
prog
rams.
You will be subject to disciplinary penalties for submitting assignments that
are too late, that are not your own work or are too similar to the work of other students.

A late penalty of
25 points per class period

will be assessed.



ITP 120 Course

Schedule


Class
Number

Date

Topics

Reading
Assignment

1

0
8
/
22
/201
2

Elementary

Java Programs

Installing
the
Java Developer Kit (JDK)

Primitive Data Types


Chapter 1




C
hapter 2

2

0
8
/
29
/2012

Primitive Data Types

Input and Output


Chapter 2


Chapter 2

3

0
9
/
0
5
/2012

Selection Statements

Loop Statements


C
hapter 3


Chapter 4

4

0
9
/
12
/2012

Loop Statements

Methods


Chapter 4


Chapter 5


5

0
9
/
19
/2012

Methods


Chapter 5

6

09/26/2012

Arrays


Chapters 6
-
7

7

10/03/2012

Classes & Objects


Chapter 8

8

10/10/2012

Classes & Objects


Chapter


8


9

10/17/2012

Strings


Chapter 9

10

10/24/2012

Inheritance & Polymorphism

Abstract Classes & Interfaces

(optional)


Chapter 11


Chapter 15

11

10/31/2012

Midterm Examination


All

Previous

12

11/07/2012

Exception Handling




(optional)

File I/O


Chapter 14


Chapter 14

13

11/14/2012

GUI Basics


Chapter 12

14

11/28/2012

Event
-
Driven Programming


Chapter 16

15

12/05/2012

GUI Components


Chapter 17

16

12/12/2012

NVCC Common Final Examination

NVCC Standard





5


WARNING

!


DO

NOT

EXPECT

TO

WORK

ON

JAVA

ONLY

ONE

DAY

EACH

WEEK.


YOU

MAY

NOT

BE

SUCCESSFUL

IN

THIS

COURSE

!



*****


Policy

of

Academic

Honesty

and

Integrity


*****



Each student has a responsibility to submit work that is uniquely his or her own,

or to provide clear and complete acknowledgement of the use of work attributed to others.

The following actions are expected of students:

1.

Complete all work on exams
without

assistance from other students
or the
professor.

2.

Follow the professor’s instructions when completing all class assignments.

3.

Ask for clarification when instructions are not clear.

4.

Report to the instructor any unauthorized information related to an exam.

a.

Pr
ovide proper credit (footnotes or bibliography) when quoting or
paraphrasing.

b.

Submit only one’s own work !

Do NOT Copy !

c.

Do NOT copy

Java programs

from the Internet !

d.

Use these program naming conventions:


Exercise1_10Smith.java


(
the
Java source
program)



which compiles into
this
Java bytecode file:


Exercise1_10Smith.class

(bytecode file)



R
eplace
Smith

with your
own

last name



Students who do NOT accept responsibility for the integrity of their own work

will

experience sanctions, including failure of the assignment and/or failure of the
course.














6


Student Learning Outcomes

Primitive Data Types



Write Java statements to declare and initialize integer, long, float, double, char, and boolean
variables



Write Java statements to assign values to variables using expressions containing mathematical
and boolean operators.



Write Java statements to create arithmetic expressions following order of precedence rules



Write Java statements using boolean

operators to include and (&&), or (||), and not (!).



Write Java statements using the relational operators to include greater than, greater than or equal
to, less than, less than or equal to, is equal to, and not equal to.



Write Java statements using the a
rithmetic operators to include add, subtract, multiply, divide,
and modulus.



Write Java statements using the increment and decrement operators



Write Java statements using pre and post increment and decrement operators



Write Java statements using the short
cut arithmetic assignment operators to include +=,
-
=, *=,
/=, and %=.



Write Java statements incorporating cast operators for primitive data types in arithmetic
expressions appropriately.



Write Java statements to declare named constants.



Write Java stateme
nts using both named and literal constants in java programming statements.

Input and Output



Console Input

o

Write Java statements to complete console input using Scanner class.

o

Write Java statements including appropriate prompt messages for keyboard input.



C
onsole Output Section

o

Write Java statements including print, println, and printf for output statements to the
console.

o

Write Java statements for console output including text labels and data values from the
program.

o

Write Java statements to include column
headings and section headings in program
output reports.



GUI Input

o

Write Java statements to complete GUI input using JOptionPane and showInputDialog

o

Write Java statements to include a prompt message and a window title for the GUI Input



GUI Output

o

Write Jav
a statements to complete GUI output using JOptionPane and
showMessageDialog.

o

Write Java statements including an output message and window title for the GUI output.



Write Java statements to validate input of data from the keyboard.


Selection Statements



Write Java statements to create and use an if statement without an else statement (one branch).



Write Java statements to create and use an if/else statement (two branches).



Write Java statements to create and use an if/elseif/else statement (multi
-
level, m
any branches).



Write Java statements to create and use an if statement within the body of another if statement
(nested).



Write Java statements to create and use switch/case statements including default option.



Write Java statements using the conditional op
erator.



7


Loop Statements



Write Java statements to construct and use a while loop



Write Java statements to construct and use a do/while loop



Write Java statements to construct and use a for loop



Write Java statements to use loop statements appropriately
for the following situations

o

Be able to create and use a counter control loop appropriately

o

Be able to create and use a data validation loop appropriately

o

Be able to create a loop that is controlled with a sentinel value

Methods



Write Java statements to cr
eate a method that takes one or more input arguments.



Write Java statements to create a method that takes no input arguments.



Write Java statements to create a method that returns a value.



Write Java statements to create a method that does not return a
value.



Be able to differentiate between pass by value and pass by reference



Be able to understand the difference between static methods and non
-
static methods.



Write Java statements to create a method that takes an array as an input argument.



Write Java st
atements to create a method that returns an array.



Write Java statements to create overloaded methods.



Write Java statements to use local variables in a method.

Arrays



Write Java statements to declare, create, and initialize a one dimensional array.



Unders
tand the memory allocation for a one dimensional array including both the array reference
and the memory for the array elements.



Write Java statements to fill an array with values.



Write Java statements to print out the contents of an array.



Write Java sta
tements to copy one array to another array.



Write Java statements to access every element in an array for analysis for the data.



Understand the concept of parallel arrays and their relationship to classes and objects.

C
lasses and Objects



Be able to define
the relationship between a class and an object.



Write Java statements to create a class that includes attributes and methods.



Write Java statements to create objects.



Understand the visibility modifiers to include: public, private, protected, and no modifi
er



Write Java statements to create and use static attributes



Write Java statements to create and use constant attributes



Be able to define the purpose of a constructor.



Write Java statements to create and use constructors.



Write Java statements to create a
nd use an overloaded constructor



Be able to define the purpose of an accessor method (get method)



Write Java statements to create appropriate accessor methods for a class (get methods).



Be able to define the purpose of a mutator method (set method).



Write Java statements to create appropriate mutator methods for a class (set methods).



Write Java statements to print out all attributes in a class.



Be able describe the following object oriented programming terms:

o

Encapsulation including information hidin
g and implementation hiding

o

Polymorphism

o

Inheritance



Write Java statements that pass objects to methods


8



Write Java statements that include objects as attributes



Write Java statements that return an object from a method




Use classes and objects in programs
that you write from scratch.

Strings



Write Java statements to declare, create, and use a String object.



Write Java statements using the following methods from the String class

o

equals, equalsIgnoreCase

o

compareTo

o

toUpperCase, toLowerCase

o

valueOf

o

concat

o

lengt
h

o

indexOf

o

substring



Write Java statements to declare, create, and use a Character object.



Write Java statements using the following methods from the Character class

o

compareTo

o

equals



Write Java statements to declare, create, and use a StringBuffer object.



Write Java statements using the toString from the StringBuffer class



Write Java statements to create a toString method for a class that you have created.

Files



Write Java statements to open a text file for reading.



Write Java statements to read data from a

text file.



Write Java statements to close a text file.



Write Java statements to open a text file for writing.



Write Java statements to write data to a text file.



Write Java statements using exceptions as required for file input and output.


Inheritance



Be

able to understand the purpose and uses of inheritance.



Be able to describe the relationship between a super class and a sub class.



Be able to recognize a sub class from the extends label in a class header.



Be able to describe the purpose of the super sta
tement when using inheritance.



Be able to write Java statements for simple classes using inheritance.

GUI



Be able to write Java statements that create a frame.



Be able to write Java statements that create a panel that is added to a frame.



Be able to write
Java statements that include a label on a panel on a frame.



Be able to write Java statements that include a button on a panel on a frame.



Be able to describe event driven programming.



Be able to describe the relationship between the source object, the
event type, the listener, and
the event handler used in the event handling process.



Be able to write Java statements to register a listener for a source object.



Be able to write Java statements that implement a listener.



Be able to write Java statements fo
r an event handler.

Programs



Be able to write Java programs using the results of an appropriate design methodology as a
starting point.



Be able to write Java programs combining the statements described in this document.


9



Be able to write, compile, test, and

run Java programs.


Required Time Allocation per Topic


In order to standardize the core topics of ITP 120 so that a course taught at one campus is equivalent
to the same course taught at another campus, the following student contact hours per topic are
required.


Each syllabus should be created to adhere as closely as possible to these allocations. Of
course, the topics cannot be followed sequentially. Many topics are taught best as an integrated
whole, often revisiting the topic several times, each time

at a higher level. There are normally 60
student
-
contact
-
hours per semester for a four credit course. (This includes 15 weeks of instruction
and does not include the final exam week so 15* 4 = 60 hours.


Sections of the course that are given
in alternativ
e formats from the standard 16 week section still meet for the same number of contact
hours.)


The final exam time is not included in the time table.


The category, Other Optional Content,
leaves ample time for an instructor to tailor the course to special

needs or resources.



Topic

Time in Hours

Percentages

Primitive data types

7

11.67
%

Input and Output

5

8.33
%

Selection Statements

3

5.00
%

Loop Statements

3

5.00
%

Methods

7

11.67
%

Arrays

4

6.67
%

Classes and Objects

8

13.33
%

Strings

3

5.00
%

Testing to include quizzes, tests, and
exams (not including final exam)

5

8.33
%

Files

2

3.33
%

Inheritance

2

3.33
%

GUI

5

8.33
%

Programs


2

3.33
%

Other Optional Content

4

6.67
%

Total

60

100%