Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > General Computer Support > help with Java <identifier> expected

Reply
Thread Tools

help with Java <identifier> expected

 
 
msnider9 msnider9 is offline
Junior Member
Join Date: Apr 2008
Location: Houston
Posts: 1
 
      04-13-2008
I am new to java and having problems with this last error.
Code:
package prg420.week5;                   // adds the package
import java.text.DecimalFormat;           // Import the java. text for formating
import java.lang.Math;          //Import the java math

class Calculator //creates and start this class
{
public class months<i> {
                                         

    public void add (i) ; {
        this.i = i;
    }

    public i get() {
        return i;
    }
}

public void MortArray()                   //creates array
{
java.text.DecimalFormat df2 = new java.text.DecimalFormat(",###.00");  // formats numbers to display only two decimal places

                  // declare variables
        double monPayment [] = new double [3] ;       // monthly payment
        double monIntRate [] = new double [2] ;       // monthly interest rate
        int months[] = new int [1] ;             // length of loan in months
	                            
                           
double[][] mortgage =

{{200000, 84, 5.35, 0.0},
{200000, 180, 5.50, 0.0},
{200000, 360, 5.75, 0.0}};

//Using an array
months = months[1];
monIntRate = (mortgage[i][2]/12)/100;
monPayment = (mortgage[i][0]*monIntRate)/(1-Math.pow(1+monIntRate, -months));

System.out.println ("\n\nMortgage amount is \t" + df2.format(mortgage[i][0]));
System.out.println ("Terms of mortgage is \t " + mortgage[i][1] + "months");
System.out.println ("Interest rate is \t " + mortgage[i][2] + "%");
System.out.println ("Monthly mortgage payment \t$" + df2.format(monPayment));

 if(months == 1){
           System.out.println("\n\n\nPayment\t\tPrincipal\t\tInterest\tPrincipal");
           System.out.println("Month #\t\tPayment\t\t\tPayment\t\tBalance");
           System.out.println("-------  \t---------\t\t---------\t---------");
          }
	       System.out.println();
	       System.out.println(months+ "\t\t$" + df2.format(monPayment) +
                      " \t\t$" + df2.format(monthlyIntPay) +
                      "\t\t$" + df2.format(balance));

       
           {
             System.out.print("\nPress Enter To Continue showing payments for for Loan No. " + (i+1)+":");
             byte[] buffer = new byte[12];
             System.in.read(buffer);
             counter = 0;
             if(months[i]){
             System.out.println("\n\n\nMonths\t\tPrincipal\t\tInterest\tPrincipal");
             System.out.println("\t\tPayment\t\t\tPayment\t\tBalance");
             System.out.println("---------\t---------\t\t---------\t---------");


for(int i=0; i<3; i++)                         // starts loop
{for (int count = 1; count < 360; count ++)
{
	if (count == 15) 
	 break;
};


System.out.println ("\n\nMortgage amount is \t" + df2.format(mortgage[i][0]));
System.out.println ("Terms of mortgage is \t " + mortgage[i][1] + "months");
System.out.println ("Interest rate is \t " + mortgage[i][2] + "%");
System.out.println ("Monthly mortgage payment \t$" + df2.format(monPayment));
}
}
}
}
public class MortCalculator	
{
    public static void main( String args[] )    //Create main method
	{
		Calculator  CalculatorA = new Calculator(); //Create object with instance of MCalc

		CalculatorA.MortArray();      //Call array
                int count=0;
		// these conditional statements cause the results to pause
		        if(count == 15)
		        {
			count = 0;
			try
			{
			Thread.sleep(5000);		// pause to last five seconds
			}                         //end thread
			catch (InterruptedException e)
			{
			}
			}	// end if
			else
			{
			count++;
			}	// end else
}		
}
}
What do I need to do to fix this final error?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JAVA < identifier > expected error Tcole90 General Computer Support 0 03-29-2010 09:08 PM
Identifier Expected Error. New to Java! Tim Java 11 12-08-2009 04:43 PM
Compiler Error Message: BC30201: Expression expected. - Please Help Moe Sizlak ASP .Net 1 08-06-2009 12:08 PM
Java String.replaceAll() not behaving as expected William Krick Java 4 12-18-2008 03:08 PM
Border using Tables not doing what I expected.. help Applebrown HTML 0 05-21-2004 02:46 PM



Advertisments