COM3113 -- Fundamentals of Programming -- Assignments
College of Computer Science -- Northeastern University
Fall Quarter 2002
Assignment 3
Due by the end of Monday, Nov. 4th.
Part 1: Reading Assignment
Java 2 A Beginner's Guide By Herbert Schildt
Module 5 and Module 6
Page 169 to Page 261
Part 2: Coding Assignment
Compute the percentage of four bases in a sequence
Scan the sequence string, count the numbers of A, T, C and G and calculate the
percentage of each base.
For example:
in sequence" ATTGCCCTTA"
#A: 2 %A: 20%
#C: 3 %C: 30%
#G: 1 %G: 10%
#T: 4 %T: 40%
Hard-coded the sequence in your code
-
Assign the initial value of your sequence string inside your program
For example: String s="ABCD"
Draw 4 rectangles in your Applet window to represent the percentage for each base
Jing's demo is here
Here is Dori Smith's sample code to draw colorful rectangle in a Java Applet.
Note: I use number in my demo. But in your assignment, you should use percentage, which is almost the same as what I did.
For all other Java Applet Sample Code from Dori Smith, click
http://www.chalcedony.com/java/index.html?applets.html
For Java Library from Sun website click here
Back to assignments index page