class, interface, or enum expected?

Using the Java SDK with TextPad

Moderators: AmigoJack, helios, bbadmin, Bob Hansen, MudGuard

Post Reply
jealzylu29
Posts: 1
Joined: Tue Nov 09, 2010 3:57 pm

class, interface, or enum expected?

Post by jealzylu29 »

I have received the error message class, interface, or enum expected. What does this mean and how can I fix it?

this is the code:


/*This program will display the mortgage payment amount from user input of the amount of the mortgage and the user's selection*/

public void main(String[] args)

{

double principal = 200000; //Principal of note
double mortgageTerm = 0; //Years of the loan (30, 15, and 7)
double interestRate = 0; //Interest of the loans (5.75%, 5.5% and 5.35% APR)
double monthlyRate = 0; //Monthly interest paid (0.48, 0.45, and 0.45)
double monthlyPayment = 0; //Monthly payment
double totalMonths = 0; //Declares month (360, 180, 84 months)
double multiplier=0; //Declares placeholder


/* Calculated variables for the mortgage calculations (monthly rate and term)*/
totalMonths = mortgageTerm * - 12;
multiplier = 1 + monthlyRate;
multiplier = Math.pow(multiplier, totalMonths);
multiplier = 1 - multiplier;


/* Calculate the payment amount*/
double []loanUpdate = {7, 5.25F, 15, 5.5F, 30, 5.75F}; //This will give the monthly payment of the loan

/* Print the result*/

System.out.println("Payment = %.2f"); //This will print a hard copy of the statement "Payment"
System.out.println("Term of Note: years");
System.out.println("The principal is:200000");
System.out.println("Interest Amount: 0");
System.out.println("Interest Rate: 0");
System.out.println("Monthly Payment: 0");
System.out.println("Monthly Interest= 0");
Jesus
Posts: 1
Joined: Sun Jan 02, 2011 5:10 am

Trying to help

Post by Jesus »

// Try this see if it works.


public class Tester
{
public static void main(String[] args)
{
double principal = 200000; //Principal of note
double mortgageTerm = 0; //Years of the loan (30, 15, and 7)
double interestRate = 0; //Interest of the loans (5.75%, 5.5% and 5.35% APR)
double monthlyRate = 0; //Monthly interest paid (0.48, 0.45, and 0.45)
double monthlyPayment = 0; //Monthly payment
double totalMonths = 0; //Declares month (360, 180, 84 months)
double multiplier=0; //Declares placeholder
/* Calculated variables for the mortgage calculations (monthly rate and term)*/
totalMonths = mortgageTerm * - 12;
multiplier = 1 + monthlyRate;
multiplier = Math.pow(multiplier, totalMonths);
multiplier = 1 - multiplier;
/* Calculate the payment amount*/
double []loanUpdate = {7, 5.25F, 15, 5.5F, 30, 5.75F}; //This will give the monthly payment of the loan
/* Print the result*/
System.out.println("Payment = %.2f"); //This will print a hard copy of the statement "Payment"
System.out.println("Term of Note: years");
System.out.println("The principal is:200000");
System.out.println("Interest Amount: 0");
System.out.println("Interest Rate: 0");
System.out.println("Monthly Payment: 0");
System.out.println("Monthly Interest= 0");
}
}
Post Reply