Program Help!!!!!!!!!!!!

From: DrNoose (drnoose_at_Idontthinkso.com)
Date: 01/28/05


Date: Fri, 28 Jan 2005 10:20:20 -0600

Hi!

I'm new to Java programming. I have a program due for class next week
and I'm having some difficulties.

I've done a little programming before, but not very good at it! LOL

One of my biggest problems (and there are many!) is that I'm not
familiar with Java. I downloaded the latest version of Java from SUN.
I'm just not real sure how to use it. The teacher gave an example but
mine doesn't seem to be working.

First, I typed to program (based on a sample from my book) into notepad
and saved it as LoanKEG.java into the bin directory on my java program.
When I go to the command line and bring up the directory and type the
commands that the teacher gave (C:\Documents and Settings\Administrator>cd..
C:\Documents and Settings>cd..
C:\>f:
F:\>path=c:\Program Files\Java\jdk1.5.0\bin
F:\>javac NewFeatures.java (the name of the program is actually LoanKEG)
F:\>java NewFeatures
...

If I'm in that directory and bring up the command line, then the command
line brings me to: C:\Program Files\Java\jdk1.5.0_01\bin.

When I type javac LoanKEG.java it comes back and says "Exception in
thread "main" java.lang.NoclassDefFoundError: LoanKEG

I'm not sure what to do. Here is the code that I wrote for the program:
Any help is appreciated!!!

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Author: Kathy Gibson
// Course: ITSE 2417
// Program No: 1
// Due Date: 2/4/2005
//
// Program Name: LoanKEG.java
// Program Description:
// This program will compute the number of months it will take to
// pay off a loan based on a beginning principal balance of $1000,
// with an interest rate of 18% per year.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

import java.text.NumberFormat;

     // Computes the number of months and total interest paid on a
$1000.0 loan
     // at 18% per year.

public class LoanKEG
{

         // Amount of the loan

     public static final double LOAN_AMOUNT = 1000.0;

         // Annual interest rate, as a percentage

     public static final double ANNUAL_RATE = 18.0;

         // Amount of monthly payment

     public static final double MONTHLY_PAYMENT = 50.0;

     public static void main(String[] args)
     {

             // Compute the monthly interest rate, as a fraction

         double rate = (ANNUAL_RATE/100.0)/12.0;

             // principalRemaining will contain the amount of the loan that
             // is not yet paid off.

         double principalRemaining = LOAN_AMOUNT;

             // totalInterest will contain the total amount of interest
paid over
             // the life of the loan.

         double totalInterest = 0.0;

             // Make a counter for the number of months
         int months = 0;

             // Loop as long as the remaining principal is greater than 0

          while (principalRemaining > 0.0)
          {
              months++;

  }

         NumberFormat moneyFormat = NumberFormat.getCurrencyInstance();

         System.out.println("It will take " + months +
             " months to pay off a loan of " +
moneyFormat.format(LOAN_AMOUNT));

         System.out.println(
             "at an annual interest rate of " + ANNUAL_RATE + "%.");

         System.out.println("You will pay a total of " +
             moneyFormat.format(totalInterest) + " in interest.");
     }

}



Relevant Pages

  • Re: How to import an external jar?
    ... I'm new user in Java programming and when I compile a java program with ... classpath at compile time. ... have Ant built in, but note that it is important ... command line, as Ant simply provides a convenient ...
    (comp.lang.java.help)
  • Re: How to import an external jar?
    ... When I compile the little program, I use the following command: ... I'm new user in Java programming and when I compile a java program with ... have Ant built in, but note that it is important ...
    (comp.lang.java.help)
  • Re: Program Help!!!!!!!!!!!!
    ... > I'm new to Java programming. ... > If I'm in that directory and bring up the command line, ... > When I type javac LoanKEG.java it comes back and says "Exception in ... You have to be in the same folder as your class. ...
    (comp.lang.java.help)
  • Recommend a book?
    ... Can you recommend an intro to Java programming in Linux? ... command to give at the command line. ... They will drag you down to their level and win ...
    (comp.lang.java.programmer)
  • Re: Recommend a book?
    ... > Can you recommend an intro to Java programming in Linux? ... > command to give at the command line. ...
    (comp.lang.java.programmer)