Programming+Assignments

Programming Assignments
You will be responsible for the following topic notes, chapter readings, questions and programming assignments:
 * Spring 2011**
 * MARKING PERIOD 2**
 * Assignment 1 - **
 * 1) **Develop your assigned case study page.**
 * 2) **Do research and develop a presentation on your assigned biometic topic.**

//**Textbook: Starting Out With Java**//
 * MARKING PERIOD 1**
 * Assignment 1 ** - **Chapter 14 - Recursion - 4 pts**
 * 1) CL 14-4 pg. 918 FactorialDemo.java
 * 2) CL 14-5 pg. 921 RangeSum.java
 * 3) CL 14-6 pg 923 Circles.java
 * 4) CL 14-7 pg 925 FibNumbers.java


 * Assignment 2 - Dynamic Data Structure also know as Abstract Data Types (ADTs) - 7 pts. **
 * 1) Follow this explanation of[| recursion using the factorial example.] Understand it. Follow this recursion [|example:]Now "play computer": Use the same function as the last example, create a table and show the recursive calls (as in the example) using a base of 5. f(n)=f(n-1)+7 //Base Case:// f(0)=5
 * 2) Go to the [|Nodes and Linked Lists]and make sure you can example each step of the [|demo] showing each step of how to add a node to the head of a linked list. Repeat demo until you understand it. You will be asked to explain it and you will be tested on it. Draw a diagram to show the following list of names in a linked list added in the following order (you will be adding James first and Ruby last): James, Cary, Lou, Zach, Ruby Show the actual name in the data field and then the reference field (also referred to as a pointer or link). Now take the same data and enter it into the applets at the bottom of the [|Nodes and Linked Lists] page. Observe the output.
 * 3) Write the psuedo code to put names in alphabetical order in a linked list.
 * 4) Define and understand a [|Doubly Linked List]. What does it allow you to do that an Singly Linked List doesn't? Add the above list of names to the Applet on the bottom of the page. Click on Next and Previous and see what it does. View the[| Demo] Understand how you add a new node.
 * 5) Read about [|ADT Stacks]. What is a stack? Describe what a push & pop does. Define LIFO. [|List uses of a stack.] What is a stack overflow and underflow? [|Click here and scroll down to: Stack and Queue Applications]
 * 6) Read about [|ADT Queues]. What is a queue? Define FIFO. [|Read this]. Why is a queue used?
 * 7) Define a [|binary tree.] List an application of a binary tree? View the [|Binary tree Demos.] How do we traverse a binary tree? Create a binary tree with the following data: 20, 10, 4, 8, 30, 25, 12, 2, 1


 * Assignment 3 ** - **Linked List Programming - 4 pts**
 * 1) Create StudentCreateNode.java & StudentList.java [|from this page:]Create an HTML page with an applet that calls the StudentList.class (See page 832 in textbook)
 * 2) Modify StudentList.java - Add a new button and method to **remove a node from the head of the list**. (rmheadNode). Be careful to check that the list is not empty first!
 * 3) Modify StudentList.java - Add a new button and method to **remove nodes at the tail of the list** instead of the head. (rmtailNode). You can use a method similar to displayList to get to the end node.
 * 4) Modify StudentList.java - Add a new button and method to **add a node at the tail of the list** instead of the head. (addtailNode). You can use a method similar to displayList to get to the end node.

//**Textbook: Starting Out With Java**// 1. What is a program made of? What are the common elements? Be able to describe each. 2. What are reserved words? 3.What is a variable? What does a variable name represent? 4. What is a compiler? 5. What is the source code? 6. What does the compiler create with the source code? 7. What is the Java Virtual Machine (JVM)? 8. What does portability mean? ...that Java is a portable language? 9. What is an Integrated Development Environment (IDE)? 10. Name 3 IDE's Go a Google search
 * Fall 2010**
 * Chapter 1 Questions: **


 * Page 18 Checkpoint - 7 questions**


 * Page 24-25 - Review questions -** Do together


 * Page 26 - Algorithm Workbench**
 * 1) 2 Sales Tax


 * Page 26 - Predict the Result**
 * 2


 * Page 27 - Short Answer** 1-17 - Do together


 * Chapter 2 - The Parts of a Java Program **
 * Create and run the following PROGRAMS:**
 * 1) Pg 61 Code Listing 2-17 - **Wages** - MODIFY the program. Assuming a 30% tax rate. Print out the gross pay (before taxes), total tax amount (30% of gross pay) and the gross pay (after taxes - "take home" pay). Use proper Java variable naming conventions.
 * 2) Pg 76 Code Listing 2-19 **StringLength**
 * 3) Pg 77 Code Listing 2-20 **StringMethods** - Modify the program. Use a loop to determine the position of the first blank character in the string.
 * 4) Pg 89 Code Listing 2-27 **Payroll**
 * 5) Pg 97 Code Listing 2-30 **NamesDialog** - Modify the program to ask for the city and state the person lives in.
 * 6) Pg 99 Code Listing 2-31 **PayrollDialog** - Modify the program to display the Net pay assuming a 35% tax rate.


 * Chapter 3 - A First Look at Classes and Objects **
 * Create and run the following PROGRAMS.**
 * __PART I - DUE 11/3__**
 * Passing ONE argument to a method:**
 * 1) Pg 128 Code Listing 3-6 Rectangle (Phase 4) - compile it. This class will be called on in the next program. **Class & methods.**
 * 2) Pg 129 Code Listing 3-7 RectangleDemo (Creates ONE **instance** of the Rectangle class and demonstrates using all the methods.) What does the keyword "new" do?
 * 3) Pg 135 Code Listing 3-9 RoomAreas - READ 3.3 Concept and understand it! **Instance Fields and Methods.**
 * 4) **Modify Rectange.** Add a method to setHeight, add a method to getHeight and add a method to getVolume (length x width x height).Understand what a **constructor** is (pg 139) - be able to describe a constructor - I will be asking. **Modify RectangleDemo** to calculate the volume of the rectangle and output it.


 * __PART II - DUE 11/10__**
 * Passing MULTIPLE arguments to a method:**
 * 1) Pg 139 Code Listing 3-10 **Modify Rectangle.java** to allow for multiple arguments
 * 2) Pg 140 Code Listing 3-11 **ConstructorDemo** - use this program to call the modified Rectange.java program
 * 3) Pg 140 Code Listing 3-12 **RoomConstructor** - this program creates THREE INSTANCES of the rectange class.
 * 4) **Write the pseudocode** for the above program.
 * 5) **Draw a diagram** to represent the instances in RAM.
 * 6) **Modify the Rectange** class to include a third parameter: height and to calculate volume if you have not already done so.
 * 7) **Modify the RoomConstructor** to pass the third parameter: height and output the volume of each room
 * 8) When would you need to know the volume of a room? To purchase the correct size what?


 * __PART III - DUE 11/12__**
 * Refer to pgs 78-152 (or use index) and** DEFINE:
 * 1) variable
 * 2) variable scope
 * 3) class
 * 4) instance
 * 5) instance field
 * 6) return statement
 * 7) public void - pg 119-120
 * 8) public double
 * 9) public int
 * 10) argument
 * 11) parameter
 * 12) private access specifier
 * 13) public access specifier
 * 14) constructor
 * 15) variable shadowing
 * 16) packages
 * 17) the import statement
 * 18) explicit and wildcard import statements
 * 19) API packages pg 153


 * Chapter 4 - Decision Structures **
 * Part I - 10 pts **
 * 1) Pg 173 Code Listing 4-1 **AverageScore.java -** Modify the program to print out a message if the score is below 65 to say something.
 * 2) READ through Pg 181-182 Code Listing 4-3 **Payroll.java** and READ through Pg 184 Code Listing 4-4 **GrossPay.java.**
 * 3) How is this approach different from the **Wages.java from pg 61 in chapter 2**?
 * 4) How many methods are there in Payroll.java?
 * 5) How many of them get a parameter passed to them?
 * 6) How many return a value?
 * 7) When a Payroll object is created (instantiated), what memory is reserved in RAM?
 * 8) What does the constructor do in this program?


 * 1) Modify the Payroll.java & GrossPay.java programs above **so that you can ask for the users tax rate, calculate the taxes that will be subtracted and** print out the employee's net pay.
 * 2) Draw a new UML diagram of the Payroll class to reflect your modifications (refer to page 181).
 * 3) Pg 193 Code Listing 4-7 **LoanQualifier.java** - examine the logic flowchart on page 195.
 * 4) Pg 196 Checkpoint 4.15 - **Modify Code Listing 4-7** according to directions.
 * 5) Pg 198 Code Listing 4-8 **LogicalAnd.java**
 * 6) Pg 201 Code Listing 4-9 **LogicalOr.java**
 * 7) Pg 202 Code Listing 4-10 **LogicalNot.java**

Read pg 208 - 216. **In your notes : **
 * Part II **
 * 1) The String class offers 2 methods: .equals and .compareTo. What is the difference?
 * 2) In Code Listing 4-16, what is the scope of the variable years?

__Read about the Switch Statement on pages 220-221__ Read pg 227-228 on Formatting Number with the DecimalFormat class
 * 1) Pg 224 Code Listing 4-21 - **PetFood.java**
 * 2) Write a program that does the Checkpoint on pg 225-226, 4.24 Save As: **NumSwitch.java**
 * 3) **In Notes** do: pg 226 4.25-4.28 ...**SKIP 4.27**

BEFORE XMAS BREAK WORK:

Create a program to do the payroll calculations for a NYC Sanitation Worker. Name the program: Sanitation The program will determine each employee's paycheck information for the week. You will open and read a "payroll" file that contains each employees payroll information. Each field in the record will be separated by a pipe "|". The worker gets paid his normal rate of pay for the first 40 hrs (a normal work week). If he works more than 40 hrs., he makes **time+a half pay** (rate of pay+1/2 rate of pay) for those **overtime** hours. He pays a 20% rate of tax if he makes less than $1,000 otherwise he pays a 25% rate of tax. Output each employee's hours worked, rate of pay, regular pay, overtime rate of pay, overtime hours worked, overtime pay, gross pay and net pay. Refer to this program for help: //The record with have the following format: **Payroll Period|Last Name|First Name|Social Security No.|Rate of Pay|Hours Worked**// Pay Period (Format = mmddyyyy) Social Security No. (Format = xxx-xx-xxxx) First Name Last Name Rate of Pay Format = decimal number Hours Worked = decimal number 12122010|122-22-4444|William|Smith|25.50|55 12122010|332-44-5454|Kieran|Hepworth|35.00|60 12122010|553-54-2221|Rahad||Miah|40.50|50 Employee Name Payroll Period (mmddyyyy) Hours worked Rate of Pay Regular pay Overtime rate of pay Overtime hours worked Overtime pay Gross Pay Net Pay Output the above information on the screen and to an output file. Create the "payroll" file that you will process. Follow the format above. This will be saved as a text file. Read in and print each record from the file. Read in and clearly print out the contents of each field on each record. Write the pseudocode to the program. Write the rest of the program. Phase V Read the all the records in the file into an array to store it in memory then write a loop to print out each record.
 * Overtime Pay Project**
 * Program Description and Requirements:**
 * Input Record's Format (payroll.txt file):**
 * Example:**
 * Output to the screen:**
 * Extra Credit:**
 * Phase I**
 * Phase II**
 * Phase III**
 * Phase IV**
 * Extra Credit** [|Example]