CS4A Assignments Will Posted First Week

 

Class will have up to 13 on-line programming assignments, labeled P0-P11. Each assignment is worth 10 points, pay attention to due dates on assignment handed in 2 weeks after due date are only worth 50%. During class discussion students should create an outline, algorithm or set of notes for solving program. Your assignments can be checked three ways:

  1. Preferrable during lab time on Wednesday
  2. You can hand in hard copies of the assignment before class starts.
  3. E-mail them to me but make sure your e-mail subject header has cs4a P1..P12, where P1..P12 represents the assignment you are sending me.


  Assignment
Tentative Due Date
p0

We will be doing this assignment in Class 2nd week: fill in questionnaire, log on to blackboard, take quiz 1 and also login to lab computers.

Install Java JDK and Text Pad - Help File

Watch the History of Java Video

Tuesday 2nd Week
P1

Write a program that reads in two integers n1 and n2 and outputs...

  • Hello Your Full Name
  • value of n1 + value of n2 = n1+n2
  • value of n1 - value of n2 = n1 - n2
  • value of n1 * value of n2 = n1 * n2

Nota Bene, these three all produce different output, but only one is the best choice...

  1. System.out.println( "Sum n1+n2 = " + n1 + n2 );
  2. System.out.println( "Sum " + n1 + " + " + n2 + " = " + (n1+n2) );
  3. System.out.println( "Sum n1 + n2 " ); System.out.println( n1 + n2 );
Week 2
P2

Chapter 2 Page 125 Project 5 4th Edition - Page 117 Project 8 5th Edition,

Write a program that reads one complete line of text, find th first word in the line and move it to the end of the line.

Nota Bene Listed First is the 4th Edition page/project, second is the 5th edition page/project.

Week 4
P3

Chapter 3 Page 217 Project 2 - Page116 Project 6

Assignment Modifications

Read in a floating pointing number and then a string/character C,F or K

Translate the given temperature to the other two temperatures.

So Given 0 C Output 0 Celsius 32 Fahrenheit 212 Kelvin

Hints Lots of Ways to do this program, an easy way to do this is...

initialize C,F and K to same termperature none of them can reach

get C from K; get C from F;
Using C get F, then K

Week 3
P4

Chapter 3 4th edition Page 217 Project #4; Chapter 4 5th edition Page 231 Project #6;

Read exam grades 0..100; Display total number of A,B,C,D, and F; Negative input terminates data.

Week 4
P5

Loop Control, Arrays, String and Primitive type Review.

Write class count, program has two constructors:

(1) default constructors set the output type to arabic
(2) constructor with one string argument either "arabic", "roman" or "english"

program has three counting methods:

(1) myForCount , (2)myWhileCount, (3)myDoWhileCount,

each method counts from 1 to N (where N can be between 1 and 10).
Each method will use the respective, for, while and do while loop.

Output of the program can be in one of three formats: Arabic 1..10, roman I..X, or English text one..ten. Type of format will be determined by value of the instance variable set by constructor during instantiation time. Hint all you need to do is setup up one 2-dimensional array of type string (i.e., String[][] output).

 

week 5

P6

More About Objects and Methods

Chapter 5 -- Page 412 Project 1; Chapter 6 5th edition Page 433 Project 1;
scienceWrite, OutputFormat

week 6
P7

Arrays

Chapter 6 --- Page 498 Project 4; Chapter 7 5th Edition Page 530 Project 4
Add bubbleSort to arraySort

week 7
EC Extra Credit For October tictactoe, Will be discussing the tic tac toe code the second week in October. Battleship will be extra credit in CS4B; both Battleship and tictactoe use the same engine.

P8

Inheritance Review

Write a vehicle base class with two instance variables: number of wheels and number passengers

Write a derived automobile class that inherits base class vehicle and adds to more instance variables: number of cylinders, and gas mileage.

Pick your favorite car and write a new derived class based on automobile class, your favorite car class should add two more instance variables. In addition, your favorite car class should have one static string or method which returns the name of the car.

All three classes should have:

(1) Two constructors a default and one that sets all underlying instance variables
For example, second vehicle constructor has two arguments. but second automobile constructor has four arguments, two to set automobile instance variables, and a super call to vehicle to set its two instance variables.
(2) A writeOutput method that writes out the instance variables with descriptions, note you may want to use super to call base class methods.
(3) Two accessors and two mutators for setting and getting instance variables

week 8

10/18/08

P9

Exception Handling

Chapter 8 4th Edition Programming Project 4 page 637

Chapter 9 5th Edition Project 4 Page 674

Convert dates from Numeric format to alpha-numeric format,

Throws two exceptions: MonthException or DayException if number out of range

Week 9

P10

Streams and File IO

Write a program that scans a integer text file, and outputs largest, smallest and average. Program should read in file name from user. Modify assignment, so that you have a method that first creates the file, by writing a 1000 random numbers to a file, you should send the method should have two arguments, the output file name and the maximum value of the random number.

Chapter 9 4th Edition Programming Projects1 page 713

Chapter 10 5th Edition Project 1 Page 744

Week 10
P11

Recursion

Harmonic Progression Product i=1;n of 1/i and Geometric Product i=1,n of i

Chapter 11 4th Edition Programming Projects 6 Page 824

Chapter 11 5th Edition Project 6 Page 788

 

Week 13
P12

Data Structures and Generics

Chapter 10 4th Edition Programming Projects 6 page 784

Chapter 12 5th Edition Project Porject 8 Page 850

Species Self Contained
Week 15