Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1808
| From | "pacvek" <pacvek@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: '{' expected |
| Message-ID | <1181703020.162653.40640@d30g2000prg.googlegroups.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <jYydncMgENp6y_LbnZ2dnUVZ_q_inZ2d@comcast.com> |
| Date | 2011-04-27 15:35 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui
On Jun 12, 7:31 pm, Lew <l...@lewscanon.nospam> wrote:
> pac...@aol.com wrote:
> > hi everyone, I'm new to the java world and I'm need of dire help, I
> > have been given an assignment and for some reason I cannot compile, I
> > keep getting the same error and even when I add an extra bracket the
> > error gets greater, here is the program and hopefully someone can help
> > me out.
>
> > import java.text.DecimalFormat;
>
> > public class Mortgage Payment Calculator {
> ...
> > }
>
> > }
>
> > }
> > }
> > }
>
> You should really cite all the information, including the full, *copied* and
> pasted error message, within the body of the message, rather than merely
> hinting at it in the subject. Nonetheless, it is clear what your difficulty is.
>
> The error said '{' (left brace) expected, not right brace ('}'), so clearly
> adding right braces will not help. Adding more right braces would help even
> less. Why did you think right braces would help an error that refers to left
> braces?
>
> Where would the compiler expect a left brace? The first place is just after
> the class name in the class declaration:
>
> > public class Mortgage Payment Calculator {
>
> but instead of a left brace, the compiler finds a token 'Payment' - whoops, a
> left brace '{' expected, but not found!
>
> You have three class names in the declaration instead of only one. Just use one.
>
> --
> Lew- Hide quoted text -
>
> - Show quoted text -
/*
MortgagePaymentCalculatorCR1.java
*/
import java.text.DecimalFormat;
public class MortgagePaymentCalculatorCR1.java:3:{
//initialize numerical values
public static void main(String[] args)
//declared variables
int loanamount = 200000;
double MP;
double Principal=200000;
int[] months= new int[3];
months[0] = 84;
months[1] = 180;
months[2] = 360;
//calculate
double[] interestrate= new double[3];
interestrate[0] = .0535;
interestrate[1] = .0550;
interestrate[2] = .0575;
DecimalFormat twoplaces = new DecimalFormat("0,000.00");
//calculate
System.out.println("\tPayment Calculator\n");
//looping in progress
for(int counter = 1; counter <=12; counter++)
//calculate
PayMonthly = (loantotal * interestRate[i] / (1 - Math.pow(1/(1 +
interestRate[i]),loanlength[i]*12)));
//calculate
System.out.println("\tLoan Amount 1 = " + loanamount);
System.out.println("\tYear Term is = " + yearterm[counter]);
System.out.println("\tInterest Rate = " +
interestrate[counter]*100);
System.out.println("\tMonthly Payment is " + twoplaces.format(MP));
}
this is what I have done so far and the following errors are
'{' expected line 7
'}' expected line 55
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
'{' expected "pacvek" <pacvek@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "pacvek" <pacvek@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "pacvek" <pacvek@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "pacvek" <pacvek@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "pacvek" <pacvek@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "RedGrittyBrick" <redgrittybrick@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "kaldrenon" <kaldrenon@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "Aziz" <aziz@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "JT" <jt@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "pacvek" <pacvek@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: '{' expected "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
csiph-web