It's Chinese Take Out Time I Love Chinese About Me
An ordinary guy hoping to live life to the fullest. Awaiting the bigger things in life. Bring on the Dim Sum We Fumble With Chopsticks We Like Chinese Too
Chinese Cuisine Liverpool FC SoccerNet Aviation Automotive Adventures With Chopsticks <
Fortunes Can Be Funny EMAIL MEstop telemarketers Fortune Cookies Wish ListTake Out Boxes
|
Monday, September 04, 2006 Java, Java & more JAVA!! For the weekend, I've been dreaming java, eating java, speaking java n living with java. I had this lab assignment which I have to hand in by this Wednesday. So i started doing it on Saturday. Well, it's supposed to be an EASY exercise, but heck, it took ne quite a while to write the codes. No time for leisure, no time for my dear MQ, all my time for JAVA!! It makes me wonder how the hell Bill Gates wrote the formidable Windows95 programme more than a decade ago. *Salute* Here's a sample of one of the Java programmes i wrote: /** * CS1101 Lab #1, Exercise 3: Invest.java * * This program computes the amount gained after N years given * the principal amount (P), interest rate (R) and number of * years (N), based on compound interest. * * */ import java.util.*; import java.text.*; import javax.swing.*; import java.lang.*; public class Invest { public static void main(String[] args) { // fill in your code here double p; double r; double n; Scanner t1 = new Scanner(System.in); p = t1.nextDouble(); r = t1.nextDouble(); n = t1.nextDouble(); double sum0, sum1, sum2, sum3, sum4; DecimalFormat x = new DecimalFormat(".00"); sum0 = r/100; sum1 = 1 - Math.pow(sum0, (n+1)); sum2 = p*sum1; sum3 = 1 - (r/100); sum4 = sum2/sum3; System.out.println("Enter principal amount: " + p); System.out.println("Enter interest rate : " + r); System.out.println("Enter number of years : " + n); System.out.println("Amount = $" + x.format(sum4)); } } Yeah, this is considered simple. Haha.. I wonder what's waiting for me in the later phase of my course. It's so late n my brain is still active with all the codes floating around in my brain. I miss MQ though. Busy Schedule put both of us away from Wednesday till Saturday night. We never got separated this long, so much so that she became pretty emotional when we met on Sat night. 4 more days before we hit the quarter year mark... I'll go crash now... |
Oh I took that module last time. I hate java...
What major u took?
Post a Comment
<< Go Back and Watch me Fumble