CISK 332 115/515 Java Programming

advertisement
CIS 332—Summer 2014
Texas A&M University Central Texas
CIS 332-115 Java Programming
M-W 2:30 – 5:30 pm
INSTRUCTOR AND CONTACT INFORMATION
Instructor:
Office:
Phone:
Email:
Office Hours:
Dr. Timothy G. Woodcock
323G - Founders Hall
254-519-5783
WoodcockTG@ct.tamus.edu
MTWR – Noon-2:00 PM and by appointment
COURSE INFORMATION
Course Overview and description:
This course is geared to upper-division students and covers more topics at a faster pace than the lower-level
course. It provides an in-depth study of the Java programming language and how it implements the
principles underlying object-oriented modularity through successive focusing on structured programming
theory, functional abstraction, data encapsulation, and software module design. The course significantly
expands the coverage beyond the fundamentals by introducing and applying systematic methodologies for
isolating and correcting logic errors using debugging tools commonly found in the software industry.
Course Objective:
Understand and master syntax and features of the Java Programming Language
 Built-in data types, variables and constants – declaration, initialization, and assignment
 Expressions; math, relational and logic operators
 Interactive input and Graphical User Interfaces
 Simple file operations and streams
 Java syntax for program structures – sequence, decision, loop
 Using Java class libraries
 Creating Java methods and classes
 Creating Arrays and strings
 Exceptions and exception handling
Apply principles of program design and logic
 Structured programming use sequence, decision, and loops
 Functional abstraction
 Modular design using Java methods
 Class design incorporating all of the principles listed above
Apply principles of program logic to isolate errors
 Debuggers included with the Integrated Development Environment
 Setting breakpoints and watch variables
 Using output to report program progress
Required Reading and Textbook(s):
“Starting out with Java”, Tony Gaddis, Addison-Wesley
Note - A student of this institution is not under any obligation to purchase a textbook from a universityaffiliated bookstore.
CIS 332—Summer 2014
Course Requirements:
There will be two exams, a midterm exam worth 100 points, and a final exam worth 100 points.
There will be 8 programming assignments worth 100 points each. Assignments will be graded based on the
following rubric: 1) that the software works and does the job specified in the assignment (30%), 2)
demonstrates the concepts being covered (40%), and 3) contains the appropriate documentation
(comments)(30%).
Project #1: Demonstrate the use of variables and I/O. Write a program that asks the user to enter the following
information: 1) Verb, 2) Adjective, 3) Plural Noun, 4) Adjective, 5) Verb ending in “ing”, 6) Verb, 7) Number, 8)
Adjective, 9) Plural Noun, 10) Plural Noun, 11) Plural Noun, 12) Type of Relative, 13) Adjective, 14) Adjective,
and 15) Plural Noun. As the user enters these values, the program should save the values in appropriately named
variables. After the user has finished the program should display the following story with the user’s input in the
appropriate locations: “Come <#1> at WALMART, where you`ll receive <#2> discounts on all of your favorite
brand name <#3>. Our <#4> and <#5> associates are there to <#6> you <#7> hours a day. Here you will find
<#8> prices on the <#9> you need. <#10> for the moms, <#11> for the kids and all the latest electronics for
the <#12>. So come on down to your <#13> <#14> WALMART where the <#15> come first.”
Project #2: Demonstrate the use of decisions. Given the fact that there are 12 inches in a foot, and 5280 feet in a
mile, and one eighth of a mile in a furlong, compute the distance for a selected unit of feet, miles, or furlongs for a
given number of inches. Write a program that prompts the user for “feet”, “miles”, or “furlongs”. Then the program
should prompt the user for a distance in inches. Lastly, the program should compute the number of feet, miles, or
furlongs for the given number of inches and display this amount with the units selected.
Project #3: Demonstrate the use of loops. Write a program to calculate a hotel’s occupancy rate. The occupancy
rate = # of rooms occupied / total # of rooms. You should use loops to validate all input. Your program should start
by prompting the user for the number of floors. Validate that the number of floors must be at least 1 and no more
than 10. Your program should iterate once for each floor. For each floor, the program should ask for the number of
rooms on the floor and then the number of occupied rooms on the floor. Validate the input making sure that there
are at least 10 rooms on a floor and that the number of occupied rooms is less than or equal to the number of rooms
on a floor. (Note: Each floor can have a different number of rooms. You must ask for each floor.) Display the total
number of rooms in the hotel, the number of occupied rooms, the number of un-occupied rooms, and the occupancy
rate for the hotel.
Project #4: Demonstrate creating and using methods. Create a program that plays the rock, paper, scissors game
between the user and the computer. Create a method to compute the computer’s choice (use a random number
between 1 and 3). Prompt the user for their choice. Have a method to decide who wins (rock beats scissor, scissor
beats paper, paper beats rock, and two the same is a tie). Repeat the game until exit is chosen, then display the
number of games played, how many games the computer won, how many games the user won, and how many
games were ties (use a method to compute this). Your program MUST have at least four methods in it.
Project #5: Demonstrate arrays. Write a program where the user inputs a series of positive integers between 0 and
20, that uses an array to count how many times each integer is input. Do NOT save the integers that are input. Save
the count of the integers that are input. When the input is an integer that is out of range (<0 or >20), the program
should, for every integer whose count is greater than zero, display the integer and the count of the number of times
this integer was input.
CIS 332—Summer 2014
Project #6: Demonstrate classes. Create a class to store and manipulate Roman numerals. For simplicity, we will
use simplified Roman Numerals where 3 = III, 4 = IIII, 5 = V, 6 = VI, 7 = VII, 8 = VIII, 9 = VIII… 19 = XVIIII, etc.
Your class should store the Roman numeral as a Roman numeral and as the equivalent decimal number. The
following table shows the decimal equivalent of Roman numerals:
Roman Numeral
Decimal
M
1000
D
500
C
100
L
50
X
10
V
5
I
1
The following is the UML class diagram for Roman:
Roman
numberRoman : String
numberDecimal : Integer
Roman(Numeral : String) /*Constructor 1/*
Roman(Decimal : Integer) /*Constructor 2/*
printRoman() : String
getRoman() : String
getDecimal() : Integer
addRoman( roman2 : Roman) : Roman
subRoman( roman2 : Roman) : Roman
Your class must have these attributes and methods, but may (OK will) need other private methods to accomplish the
tasks. The following should help you decide how your Roman class will work:

Constructor 1: Accepts a roman numeral only, as a String, saves the numeral then computes and saves the
decimal equivalent of the Roman numeral.

Constructor 2: Accepts an integer number only, saves the integer and then computes and saves the
equivalent Roman numeral as a String.

PrintRoman: This method returns String with Roman numeral and decimal equivalent.

GetRoman: This method returns the Roman numeral stored in the class.

GetDecimal: This method returns the decimal stored in the class.

AddRoman: Accepts as parameter an object of type Roman and returns a new object of type Roman that
contains the sum of the class Roman numeral and the parameter Roman numeral. (Hint: you will need a method
to convert a decimal to a Roman numeral.)

SubRoman: Same as above but subtracts the smaller Roman numeral from the larger Roman numeral.
Include a program that allows the user to create objects of type Roman by using either a decimal number or a Roman
numeral. Allow the user to verify that the program works by adding and subtracting various numbers.
Project #7: Demonstrate basic GUI’s. Write a program with a GUI interface that allows a user to play a simple
game of Hi-Low. This game is played by having the computer generate a hidden number between 1 and 100. The
user guesses the number and the computer checks the hidden number against the guess and tells the user if the guess
was high or low. The round continues until the user guesses the number. The game continues as long as the user
wants to continue.
CIS 332—Summer 2014
Project #8: Demonstrate string manipulation. Write a program that encrypts and decrypts plaintext into a secret
code. For our code, we will use a simple Row transposition cipher. To encrypt a message we need two things a
message and a code key, which in this case is a series of integers. For example, let us say our message is “I want an
A in this class” and the code key is 516243. We start by creating a 2D array and putting the message in the array
one letter at a time, across the rows as shown below. (Note: A “*” is used to indicate a blank space.)
5
I
*
I
S
S
1
*
A
N
*
*
6
W
N
*
C
*
2
A
*
T
L
*
4
N
A
H
A
*
3
T
*
I
S
*
Then we reorder the columns in the array so that the code key is in numerical order and read the columns to get the
encrypted message.
1
*
A
N
*
*
2
A
*
T
L
*
3
T
*
I
S
*
4
N
A
H
A
*
5
I
*
I
S
S
6
W
N
*
C
*
Encrypted message: *AN** A*TL* T*IS* NAHA* I*ISS WN*C*
To decrypt a message you do this in reverse. There is a shortcut method for decrypting the message, and anyone
who discovers and implements this shortcut method will receive 10 bonus points.
Note 1: The code key can only contain the column number once and every column number must be in the code key.
Note 2: Do not ever use this code for any real application. Third graders with an I-phone can crack this code in less
than 5 minutes.
Unless you make prior arrangements, all late assignments will lose 30% of the available points before
being graded.
Grading Criteria Rubric and Conversion
Assignment
Mid-term Exam
Final Exam
Projects
Total Points
100
100
800
Grade
A
B
C
D
F
Points
900-1000
800-899
700-799
600-699
Below 600
CIS 332—Summer 2014
Complete Course Calendar
Date
6/4/2014
6/9/2014
6/11/2014
6/16/2014
6/18/2014
6/23/2014
6/25/2014
6/30/2014
7/2/2014
7/7/2014
7/9/2014
7/14/2014
7/16/2014
7/21/2014
7/23/2014
Topic
Introduction
Variables
If statements
While Loop
For Loop
Methods
Arrays
Midterm Exam
Classes/Objects
More Classes
ArrayList Class
GUI
File I/O
String Class
Assignments
Project 1
Project 2
Project 3
Project 4
Project 5
Project 6
Project 7
Project 8
Final Exam
Drop Policy
If you discover that you need to drop this class, you must go to the Records Office and ask
for the necessary paperwork. Professors cannot drop students; this is always the
responsibility of the student. The record’s office will provide a deadline for which the form
must be returned, completed and signed. Once you return the signed form to the records
office and wait 24 hours, you must go into Duck Trax and confirm that you are no longer
enrolled. Should you still be enrolled, FOLLOW-UP with the records office immediately?
You are to attend class until the procedure is complete to avoid penalty for absence. Should
you miss the deadline or fail to follow the procedure, you will receive an F in the course.
Academic Integrity Statement
Texas A&M University - Central Texas expects all students to maintain high standards of
honor in personal and scholarly conduct. Any deviation from this expectation may result in
a minimum of a failing grade for the assignment and potentially a failing grade for the
course. All academic dishonesty concerns will be reported to the university's Office of
Student Conduct. Academic dishonesty includes, but is not limited to, cheating on an
examination or other academic work, plagiarism and improper citation of sources, using
another student's work, collusion, and the abuse of resource materials. When in doubt on
CIS 332—Summer 2014
collaboration, citation, or any issue, please contact me before taking a course of action.
More information can be found at
http://www.tamuct.edu/departments/studentconduct/academicintegrity.php
Disability Support and Access
If you have or believe you have a disability and wish to self-identify, you can do so by providing
documentation to the Disability Support Coordinator. Students are encouraged to seek information
about accommodations to help assure success in their courses. Please call (254) 501-5831 or visit
Founder's Hall 114, Suite 114. Additional information can be found at
http://www.tamuct.edu/departments/disabilitysupport/index.php
Tutoring
Tutoring is available to all TAMUCT students, both on-campus and online. Subjects tutored include
Accounting, Finance, Statistics, Mathematics, and Writing. Tutors are available at the Tutoring
Center in Warrior Hall, Room 111. Visit www.ct.tamus.edu/AcademicSupport and click "Tutoring
Support" for tutor schedules and contact info. If you have questions, need to schedule a tutoring
session, or if you're interested in becoming a tutor, contact Academic Support Programs at 254501-5830 or by emailing tutoring@ct.tamus.edu.
Chat live with a tutor 24/7 for almost any subject on your computer! Tutor.com is an online
tutoring platform that enables TAMU-CT students to log-in and receive FREE online tutoring and
writing support. This tool provides tutoring in Mathematics, Writing, Career Writing, Chemistry,
Physics, Biology, Spanish, Calculus, and Statistics. To access Tutor.com, log into your Blackboard
account and click "Online Tutoring."
Library Services
INFORMATION LITERACY focuses on research skills which prepare individuals to live and work in
an information-centered society. Librarians will work with students in the development of critical
reasoning, ethical use of information, and the appropriate use of secondary research techniques.
Help may include, yet is not limited to: exploration of information resources such as library
collections and services, identification of subject databases and scholarly journals, and execution of
effective search strategies. Library Resources are outlined and accessed at.
http://www.tamuct.edu/library
UNILERT
Emergency Warning System for Texas A&M University – Central Texas
UNILERT is an emergency notification service that gives Texas A&M University-Central
Texas the ability to communicate health and safety emergency information quickly via
email, text message, and social media. All students are automatically enrolled in UNILERT
through their myCT email account. Connect at www.TAMUCT.edu/UNILERT to change
where you receive your alerts or to opt out. By staying enrolled in UNILERT, university
officials can quickly pass on safety-related information, regardless of your location.
CIS 332—Summer 2014
INSTRUCTOR POLICIES
Students should come to class prepared, ready to ask questions and participate in discussions.
While in other classes, the direct quoting of other authors is considered acceptable; in this class, it is not
acceptable. You may not directly quote any other published paper, web site, or textbook in any writing
assignment, including papers, homework, discussion boards, PowerPoint presentations, or any other
written assignments. The simple reason for this is that copying (quoting) is a lower level skill. However,
reading, understanding, and then communicating the ideas in your own words is a high level skill, which
is the skill that I want you to develop.
Do not submit any code that is not yours. Do not copy code from websites, other students, tutors, friends,
family, or from any other source that is not your brain. If you get help with any code, you must make it
clear which portions of the code you had help with and which you wrote. You must supply the contact
information for the person, web site, youtube video, or other person who helped you. This is very
important because you will only learn to write code by writing code. Yes, some concepts are difficult, but
if you do not write the code and solve the problems, you will not learn how to write code and solve
problems. Having someone explain a solution or algorithm to you or help you debug a problem is
acceptable and allowed. Having someone else write the code for you is not OK.
Unless you make prior arrangements, all late assignments will lose 30% of the available points before
being graded.
Dr. Woodcock reserves the right to modify this syllabus during the semester.
Instructor Information
Dr. Woodcock has a PhD in Computer Science from Florida Atlantic University. He has over 25 years of
real world experience working for IBM and Sony-Ericsson. Dr. Woodcock believes that you will learn
best by being engaged in class, asking questions, participating in discussion, and doing the hands on
exercises.
This class will be a lot of work, but it will also be fun.
Download