Our seating chart software

Java Programming Activities

Teaching resource developed while working as a high school Science and IT teacher in NSW Australia

2,852 Downloads | Download PDF DOC

You may also be interested in:
 

education teaching

SDD Activities List Programming Course PROGRAMMING ACTIVITIES LIST http://java.sun.com/javase/6/docs/ TASK 1 FUNDAMENTALS Goal: Print “Hello World” to the command line New Java Techniques: • • • • • Program structure Importing libraries IDE Output Packages Development Ideas: • • • Compilation Sequential development Modularity Extension: • Print three different statements separated by blank lines TASK 2 FUNDAMENTALS Goal: Convert Centigrade to Fahrenheit New Java Techniques: • • • • Input Variables Casting Operators Development Ideas: • Sequence Extension: • Develop another program which converts from Fahrenheit to Centigrade RL 1 29/2/08 SDD Activities List Programming Course TASK 3 Goal: Calculate the area of a circle New Java Techniques: • • Methods Math library FUNDAMENTALS New Development Ideas: • • • Sub procedure Procedural development Libraries Extension: • Write methods to calculate the area of different shapes TASK 4 FUNDAMENTALS Goal: Calculate income tax using a simple two level algorithm New Java Techniques: • If statement New Development Ideas: • Binary selection Extension: • Ask user for tax threshold and rate information before calculating tax TASK 5 FUNDAMENTALS Goal: Print the mass of any planet of the Solar System based on user choice of planet New Java Techniques: • Switch statement New Development Ideas: • Multi-choice selection Extension: • RL Rewrite the algorithm using nested If statements instead of a single switch statement 2 29/2/08 SDD Activities List Programming Course TASK 6 FUNDAMENTALS Goal: Three methods which accept simple arguments and return a simple value: 1. Calculate range of a projectile 2. Calculates the average of 5 numbers 3. Counts the number of letters in a string New Java Techniques: • • Methods String library New Development Ideas: • Subroutine Extension: • Allow the user to choose which method to run using gets and a selection statement TASK 7 FUNDAMENTALS Goal: Output the value of a $1000 investment each year for 40 years with an interest rate of 6% New Java Techniques: • For New Development Ideas: • Hint: • Write a method to perform the calculation and call this from the for loop in the main method (http://www.moneychimp.com/articles/finworks/fmfutval.htm) Repetition Extension: • Output the value of an investment each year if $10 is added each month for 40 years with an annual interest rate of 6% (http://www.frickcpa.com/tvom/TVOM_FV_Annuity.asp) RL 3 29/2/08 SDD Activities List Programming Course TASK 8 FUNDAMENTALS Goal: Throw two die 1000 times, output the value of each die and the sum of the two values New Java Techniques: • While New Development Ideas: • Hint: • Write a method to randomly choose the value of one die throw, then call this method for each die from the while loop in the main method Repetition Extension: • Calculate the probability of getting each number from 1 to 12 for the sum of two die TASK 9 DATA STRUCTURES Goal: Display a list of the students’ in the class sorted alphabetically New Java Techniques: • • Array Sorting New Development Ideas: • • Hint: • • Remember to initialize the array to the correct size before using it Don’t add the sorting feature until the program is successfully displaying an unsorted list of students Array Sorting Extension: • Request student names from the user RL 4 29/2/08 SDD Activities List Programming Course TASK 10 DATA STRUCTURES Goal: Rewrite task 5 to use two arrays to store the planet names and planet masses Hint: • Remember to initialize the arrays to the correct size before using them Extension: • Use a two dimensional array instead of two separate arrays TASK 11 DATA STRUCTURES Goal: Rewrite task 8 to store the sum of each throw in an array, then display the whole array when finished calculating (rather than during the calculation) Hint: • Create an array of the correct size Extension: • Complete the task 8 extension using arrays TASK 12 DATA STRUCTURES Goal: Display a list of planet names and their masses by storing the data in a HashMap New Java Techniques: • • Map interface Collections framework New Development Ideas: • Hint: • Creating and using a Map is different to an array Hashtable Extension: • RL Attempt to display a sorted the list of planets and their masses 5 29/2/08 SDD Activities List Programming Course TASK 13 DATA STRUCTURES Goal: Rewrite task 5 using a HashMap to associate the planet names to their masses Hint: • • Ask the user for the planet name not a number, and use it to retrieve the mass Should not require a multi-choice selection TASK 14 DATA STRUCTURES Goal: Rewrite task 9 using an ArrayList instead of an Array New Java Techniques: • • Hint: • Unlike an Array, an ArrayList is resizable, therefore you shouldn’t need to restrict the number of students allowed List interface Collections framework Extension: • Use a HashSet instead of an ArrayList TASK 15 GUI Goal:Create a random number generator. Randomly chooses a number between 1 and X, where X is chosen by the user. New Java Techniques: • • Hint: • Follow the Netbeans Swing tutorial but use a Model class Swing Simple View/Model pattern Extension: • Generate five random numbers instead of one. RL 6 29/2/08 SDD Activities List Programming Course TASK 16 GUI Goal: Create a virtual person which prints a random comment to the screen when prompted New Java Techniques: • Hint: • • Use the View/Model pattern - refer to task 15 Use an ArrayList – refer to task 14 Connecting previous ideas Extension: • Add an image with a speech bubble TASK 17 GUI Goal: Create a general filing application which can add and recall products with a code, title, and price. New Java Techniques: • Hint: • • Use the View/Model pattern – refer to task 15 Use HashMaps – refer to task 12 Tabbed panel for each functionality Extension: • Add delete and update functionality RL 7 29/2/08 SDD Activities List Programming Course Fundamentals – sequence, selection, repetition, procedures Data structures – array, hash, iteration Documentation – jdoc, reading OOP – foundations, syntax, packaging, patterns File IO – basics, persistence GUI – swing, messages CASE – uml, generation, refactoring Libraries – math, net, database RL 8 29/2/08

Download PDF DOC | More Resources