Compiler Errors With Class Definitions and Clients

Hi there, I need help with some code, here it is.

import java.util.*;

import java.text.*;

publicclass InvestCalc{

//declaration of instance variables

privatedouble interest, principal;

//default constructor, sets interest and principal to zero

public InvestCalc(){

interest = 0.0;

principal = 0.0;

}

//overloaded constructor

public InvestCalc(double startInterest,double startPrincipal){

interest = startInterest;

principal = startPrincipal;

}

//accessor methods for instance variables

publicdouble getRate(){

return interest;

}

publicdouble getPrincipal(){

return principal;

}

//mutator methods

publicvoid setRate(double newInterest){

interest = newInterest;

}

publicvoid setPrincipal(double newPrincipal){

principal = newPrincipal;

}

//String toString() method

public String toString(){

return"Interest Rate: " + percent.format(interest) +", Principal: " + DOLLAR_FORMAT.format(principal);

}

//futureValue(int year) method

publicdouble futureValue(int year){

double futureValue = Math.pow((1 + interest), year)*principal;

return futureValue;

}

//public static final class variables

publicstaticfinalint shortTerm = 5;

publicstaticfinalint middleTerm = 10;

publicstaticfinalint longTerm = 20;

//public void display Table() method

publicvoid displayTable(){

System.out.println("Year" +"\t" +"Interest Rate" +"\t\t" +"Principal" +"\t\t" +"Future Value");

System.out.println(shortTerm +"\t" + percent.format(interest) +"\t\t\t" + DOLLAR_FORMAT.format(principal) +"\t\t" + DOLLAR_FORMAT.format(futureValue(shortTerm)));

System.out.println(middleTerm +"\t" + percent.format(interest) +"\t\t\t" + DOLLAR_FORMAT.format(principal) +"\t\t" + DOLLAR_FORMAT.format(futureValue(middleTerm)));

System.out.println(longTerm +"\t" + percent.format(interest) +"\t\t\t" + DOLLAR_FORMAT.format(principal) +"\t\t" + DOLLAR_FORMAT.format(futureValue(longTerm)));

}

//formatting section

publicstaticfinal NumberFormat DOLLAR_FORMAT = NumberFormat.getCurrencyInstance();

publicstaticfinal DecimalFormat percent =new DecimalFormat("##0.00%");

}

import java.util.*;

publicclass InvestCalcApp{

/**

* @param args

*/

publicstaticvoid main(String[] args){

// TODO Auto-generated method stub

//declare Scanner class and interest, principal vars

Scanner input =new Scanner(System.in);

double interest, principal;//vars for the interest rate and initial investment

//instantiate a default object of the InvestCalc class

InvestCalc value1 =new InvestCalc();

System.out.println("Default InvestCalc Object");

System.out.println(value1.toString()+"\n");

//query for interest and principal

System.out.print("Enter an interest rate in decimal format: ");

interest = input.nextDouble();

System.out.print("Enter the initial investment value: ");

principal = input.nextDouble();

//change object and output

value1.setRate(interest);

value1.setPrincipal(principal);

System.out.println("Updated InvestCalc Object");

System.out.println(value1.toString());

//test the futureValue method and the DOLLAR_FORMAT static class variable

System.out.println("Value after 1 year " + InvestCalc.DOLLAR_FORMAT.format(value1.futureValue(1)) +"\n");

value1.displayTable();

//query for another interest and principal

System.out.print("Enter another interest rate in decimal format: ");

interest = input.nextDouble();

System.out.print("Enter another initial investment value: ");

principal = input.nextDouble();

//instantiate an object of the InvestCalc class

InvestCalc value2 =new InvestCalc(interest, principal);

System.out.println("Non-Default InvestCalc Object");

System.out.println(value2.toString()+"\n");

value2.displayTable();

}

}

When I compile InvestCalc.java it compiles; however, when I compile InvestCalcApp.java I receive 5 errors:

InvestCalcApp.java:15: cannot find symbol

symbol :class InvestCalc

location:class InvestCalcApp

InvestCalc value1 =new InvestCalc();

InvestCalcApp.java:15: cannot find symbol

symbol :class InvestCalc

location:class InvestCalcApp

InvestCalc value1 =new InvestCalc();

InvestCalcApp.java:32:package InvestCalc does not exist

System.out.println("Value after 1 year " + InvestCalc.DOLLAR_FORMAT.format(value1.futureValue(1)) +"\n");

InvestCalcApp.java:42: cannot find symbol

symbol :class InvestCalc

location:class InvestCalcApp

InvestCalc value2 =new InvestCalc(interest, principal);

InvestCalcApp.java:42: cannot find symbol

symbol :class InvestCalc

location:class InvestCalcApp

InvestCalc value2 =new InvestCalc(interest, principal);

Sorry if that's a lot of reading, but I need help, I'm new at this and not quite sure what those errors mean. Thanks

[9747 byte] By [jataggarta] at [2007-10-3 6:07:33]
# 1
The errors mean the compiler can not find the InvestCalc class. The compiler looks for classes using the Classpath. It might work if you use a command likejavac -cp . InvestCalcApp.javaThis command tells javac to look in the current directory for dependent classes.
atmguya at 2007-7-15 0:50:39 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...