| |
|
Assignment XVII Due Thursday 04/24/08 by 1:00 AM
|
|
Assignment XVI Canceled
|
- Develop a better setSequence() method for a strand.
|
Assignment XV
Due Friday 04/18/08 by 2:00 PM |
- From the activities section section for 04/16/08:
- Complete Calculator.java
- Complete CalculatorTester.java
- Hand in a typed description of the constructors and methods that should be in class Course
|
Program Assignment XIV
Due Monday 04/07/08 by 2:00PM
|
- Complete the factorial in Factorial.java.
- Complete the Taylor expansion for e(x) in Taylor.java.
- 1 + x/1! + x*x/2! + x*x*x/3! + ...
- Because we do not want to go on forever, the second input to the your taylor method specifies the last term
you are to consider (x raised to the nth power) / n!
- Observer the jth term in the series can be obtained by multiplying the previous term by x and dividing by j
|
Program Assignment XIII
Due Monday 04/07/08 by 10:00PM
|
- Complete the remaining checking methods in TicTacToe.java.
- Algorithm for checking a vertical win starting at row r and column c of the board
- If the position is empty, there cannot be a win.
- If there is enough rows beyond r, there cannot be a win; that is, if r+k > number rows, then no win
- Otherwise, the contents of the board in column c, rows r+1, r+2, ... r+k-1 need to be compared to the contents of row r and column c. If there is ever a mismatch, then there is no win. If there was no mismatch there is a win.
|
Program Assignment XII
Due Wednesday
03/26/08 by 2:00PM
|
- Complete the incrementRed() task in StudentCode.java.
To see this task work in photo manipulation also download ImageGUI.java and Library.java. When you execute StudentCode.java, it will use those files to run the display.
- incrementRed(): Increases the amount of red in the pixel array by amount delta. If the new red value is in the interval 0 .. 255, then it is used to set the element. If instead, the new red value is negative, 0 is used as the new value. If instead the new red value is greater than 255, 255 is used as the new value for the array element.
- In completing the incrementRed() task, the method Library.rgbtoInt() may be helpful. For example, the assignment
- array[x][y] = Library.rgbToInt( newRed, g, b );
sets element array[x][y] to represent the color with levels newRed, g, and b respectively of red, green, and blue.
- Extra credit: complete
incrementBlue() and incrementGreen() to respectively alter the blue and green levels in the pixel array. The extra credit is only possible if incrementRed() is correct.
|
Program Assignment XI
Due Friday
03/21/08 by 2:00PM
|
- Complete the copy(), flip(), and mirror() tasks in StudentCode.java.
To see these tasks work in photo manipulation also downlown
ImageGUI.java and Library.java.
When you are execute StudentCode.java., it will use those files to run the display.
There is nothing you need in those files to help perform
tthe copy(), flip(), and mirror() tasks.
- copy(): copies the elements of array original into the corresponding elements of array duplicate
- flip:(): the elements of each row in array are reversed.
- If the array was originally
- then it should end up as
- mirror(): the elements of each column in array are reversed.
- If the array was originally
- then it should end up as
|
Program Assignment X
Due Wednesday
03/19/08 by 5:00PM
|
- Complete program MaximumCount.java. The program reports the number of times the maximum value occurs in an array.
- Complete program IsSorted.java. The program reports whether a user-specified array has its elements in sorted order.
|
Program Assignment IX
Due Friday
03/14/08
by 5:00PM
|
- Complete program KeyCount.java. The program counts the number of occurrences of a user-specified input value.
|
Program Assignment VIII
Due Wednesday
03/12/08 by 5:00PM
|
- Complete program ArrayMaximum.java. The program determines the maximum array element value.
- Complete program Negate.java. The program negates the values of an array
|
Program Assignment VII
Due Friday
02/29/08 by 5:00PM
|
|
Program Assignment
VI
Due Wednesday 02/27/08 by 10:00 PM
|
|
Programming
Assignment
V
Due Tuesday 02/12/08
by
10:00 PM
|
- Complete program
EVM.java from today's
activities
and submit
it. The program should
simulate the Earth and Venus circling the sun, and the moon circling the
earth. Distances are specified within the program.
|
Programming
Assignment IV
Due Friday 02/8/08
by
10:00 PM |
- Complete program
EV.java from today's
activities
and submit
it. The program should
simulate the Earth and Venus circling the
sun.

|
Programming
Assignment III
Due Friday 02/1/08
by
5:00 PM
|
- Complete program CarbonDater.java from today's
activities
and submit
it. Remember function Math.log() calculates logarithms.
- Develop and submit
program AverageNumbers.java. The program should prompt
its user for a list of numbers and then calculate and report the
average. My suggestion in class was to modify and rename program
SumNumbers.java from
today's activities
.
|
Programming
Assignment II
Due Wednesday 01/30/08
by
10:00 PM |
Purpose
- Demonstrate the ability to produce an interactive program.
Submissions
Summary
- Complete console program
MediaPlayerSizer.java so that it
computes an estimate of the space needed by a media player to store
a user-specified number of songs, minutes of video, and photos.

Problem -- sizing a media player
- The program
MemorySizer.java analyzed in class
even when modified to accept the size of a music library does not
meet most people's needs for sizing a media player -- the program
only considers the the number of songs to be stored. People now also
put photos and videos on their players. You are to create a better
media player sizer -- a console program named
MediaPlayerSizer.java.
Program
MediaPlayerSizer.java is to get four inputs from its
user. They are
- Desired number of songs,
- Desired minutes of video,
- Desired number of photos,
- The rating resolution of their digital camera; that is, the
maximum number of mega pixels used in capturing an image.
The inputs are to be acquired in the listed order: songs,
video, photos, and resolution. While this requirement may seem arbitrary, it
greatly helps the people who are reading, testing, and grading the
class submissions. Disregarding this requirement will cause a
significant grading point loss.
Design details
- The estimate for the needed size of a media player would be the
sum of three amounts
.(number of giga bytes for songs + number of giga
bytes for video
+ number of gigabytes for photos)
- The number of giga bytes needed to store the songs is
(number of songs • gigabytes per song)
- The number of giga bytes needed to store the video is
(minutes of video • gigabytes per video minute)
- Because the camera resolution supplied by the user is in mega
pixels, a scaling is required to compute the giga byte photo
requirements. Therefore, the number of giga pixels needed to store
the photos is
(number of photos • mega pixel photo resolution
/ mega pixels per gigapixel)
As each pixel requires a byte of memory, the needed number of
giga bytes is the number of giga pixels.
The algorithm and its implementation
- Because this effort is your first attempt at implementing an
interactive program, an algorithm is supplied to assist you in solving
the problem. My process for developing the algorithm was a visualization
process. I first considered how the program interactions should appear.
I then decided what steps were needed to produce those interactions. I
settled on the following
- Display an appropriate message to orient the user about the
program.
- Set up an interface to the user for getting input.
- Determine what the user expects of the player
- Prompt the user to supply the number of songs and get
the user's response.
- Prompt the user to supply the minutes of video and get
the user's response.
- Prompt the user to supply number of photos and get the
user's response.
- Prompt the user to supply the mega pixel resolution of
the camera and get the user's response.
- Specify constants needed for computing player size
- Average number of giga bytes per song
- Average number of giga bytes per minute of video
- Number of mega pixels per giga pixel
- Calculate the player size
- Determine the song needs
- Determine the video needs
- Determine the photo needs
- Sum the three multimedia needs
- Display a summary of the requirements and the size estimate.
Testing your program
- In general, a program is worthwhile as long as it is correct. So
as part of the assignment you need to test your program. It is
unreasonable to test your program with all possible inputs and
compare its answers with the expected answers -- it would take too
long. However, it is possible to come up with a small set of tests
to provide confidence in its construction. So what tests make sense?
One test would be to use mine from above. It gives you ability to
test your program and compare it to know good results. So what other
tests would be good. I believe three to five tests would do it.
Recommendations
- Do not delay, the first interactive program is always hard to
do.
- Understand what is being asked and required of you before
writing any code.
- Download the provided program skeleton
MediaPlayerSizer.java.
- Add header comments to the program that identify your name,
email id, section, and the program purpose.
- Before adding any code to your method main() I would copy the six major steps listed above into the
method main() and make them into
comments to document the actions of the method
main(); e.g.,
// Display an appropriate
message to orient the user about // the program.
- Introduce white space to keep the steps visually separate.
- Work on the six steps in order. Make sure the current step you
are working is correct before preceding to the next step.
- Use meaningful variable and constant names that follow Java
style conventions.
- Check the program's correctness by running test cases and hand
checking program results with expected results.
- Make sure the program has been cleaned up -- remove spurious
output that you may have added when debugging the program.
- Make sure the program is easy to read -- reasonable whitespace
and comments.
- Recheck the program's correctness by running test cases again to
make sure cleaning up did not mess things up.
Grading
- When graders examine your program and test methodology they will
make their decision by considering:
- Does the program header supply what is expected -- purpose,
name, id, and section?
- Is the program properly commented?
- Is the use of whitespace appropriate?
- Does the program display an appropriate legend?
- Does the program display proper prompts for getting the user
to provide correct responses?
- Does the program make good use of
Scanner for getting the
responses?
- Does the program define and consistently use appropriate
constants?
- Does the program define and appropriately initialize its
variables.
- Are the names of variables and constant reasonable and do
they follow Java programming style.
- Does the program compute the correct estimate?
- Does the program display the expected summary in a
reasonable manner?
- Does your test set methodology make sense?
|
Programming Assignment
I
Due
Friday 01/25/08
By
5:00 PM |
- Modify and submit
program Ugly.java
and introduce suitable whitespace to make the program reader
(aesthetic) friendly. Do not change any of the code -- the program
must still compile and perform the same actions.
// Purpose: to
display several eye idioms // Source: www.usingenglish.com public class Ugly{public static void main(String[]args){ System.out. println("Bat an eyelid");System.out.println("Bedroom
eyes") ;System.out.println("Better than a stick in the eye"); System.out.println("Blink of an eye");System.out.println( "Bright-eyed and bushy-tailed");System.out.println( "Cry your eyes out"); System.out.println("Discerning eye");System.out.println( "In the twinkling of an eye");System.out.println( "More than meets the eye"); System.out.println( "Mud in your eye");System.out.println( "Not bat an eye");System.out.println( "Pull the wool over someone's eyes" ); System.out.println("Scales fall from your eyes"); System.out.println("See eye to eye"); System.out.println("Sight for sore eyes"); System.out.println("Stars in your eyes"); System.out.println("Turn a blind eye"); System.out.println("Twinkling of an eye"); }} |
- Modify and submit
program
UhOhUhOhUhOh.java to correct its three syntax errors and
one implementation error. The program is suppose to display Elbow
grease is never messy.
// Purpose:
display Elbow grease is never messy
// Author:
// Email ID:
public class UhohUhohUhoh {
// main(): program starting point
public static void main(String[] args) {
System.out.println("Elbow grease is often
messy')
}
} |
- Modify and submit
program UVA.java
to display
UUUU UUUU VVVV VVVV AAAAAAAAAAAA
UUUU UUUU VVVV VVVV AAAAAAAAAAAA
UUUU UUUU VVVV VVVV AAAA AAAA
UUUU UUUU VVVV VVVV AAAA AAAA
UUUU UUUU VVV VVV AAAAAAAAAAAA
UUUU UUUU VVVVVVV AAAA AAAA
UUUUUUUUUUUU VVVVV AAAA AAAA
UUUUUUUUUUUU VVV AAAA AAAA |
|
Exercise
Set II
Due
Wednesday 01/23/08
By
Start of class
|
- Read Wing's paper on
computational thinking and
turn in a one page, single-spaced printed copy of a paper providing
discussion and reaction;
|
Exercise
Set I
Due
Wednesday 01/18/08
By
Start of class |
- Watch the
video the
last lecture and turn in
a one page, single-spaced printed copy of a paper discussing the
talk and its motivational power. There will be bonus credit if you hand in
your copy at the start of the first class.
|