help with Java <identifier> expected

Discussion in 'General Computer Support' started by msnider9, Apr 13, 2008.

  1. msnider9

    msnider9

    Joined:
    Apr 13, 2008
    Messages:
    1
    Location:
    Houston
    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[B]) [/B]; {
            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?
     
    msnider9, Apr 13, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vigi98
    Replies:
    0
    Views:
    4,482
    vigi98
    Jul 15, 2003
  2. Tcole90

    JAVA < identifier > expected error

    Tcole90, Mar 29, 2010, in forum: General Computer Support
    Replies:
    0
    Views:
    4,419
    Tcole90
    Mar 29, 2010
  3. Zuni

    Error: <identifier> expected

    Zuni, Nov 14, 2011, in forum: Software
    Replies:
    0
    Views:
    1,655
  4. Keke101

    <identifier> expected

    Keke101, Jan 2, 2012, in forum: The Lounge
    Replies:
    2
    Views:
    4,398
    sandi7777777
    Oct 11, 2012
  5. mdgtjulie

    <identifier> expected error in Java

    mdgtjulie, Feb 6, 2014, in forum: Software
    Replies:
    0
    Views:
    459
    mdgtjulie
    Feb 6, 2014
Loading...

Share This Page