I am writing a program that will ask the user for two things:
1. a sum of money
2. an option (they will choose by typing a letter)
the beginning of my program is as follows:
import java.io.*; // import the java io package
public class MortgageCalculator {
public static void main ( String [] args ) throws IOException //throws exceptions
{
BufferedReader stdin = new BufferedReader(new InputStreamReader( System.in ));
double Loanprinciple;
double Annualrate = 0.0;
int Years;
double Monthlypayment;
char A;
char B;
next I have a block of code which will prompt the user to enter their preference either A or B then if the user enters A; then Annualrate and Years get specific values assigned to them, if they choose B Annualrate and Years get different values.
the code i am tryin to accomplish this with is as follows:
System.out.print( "Enter your option" );
input = stdin.readLine();
if(char = A){
AnnualRate = 5.75;
Years = 30;
}else if(char = B)/>{
AnnualRate = 7.4;
Years = 15;
}
the 2 errors i am getting are
MortgageCalculator.java:33: '.class' expected
if(char = A){
^
MortgageCalculator.java:36: '.class' expected
}else if(char = B)/>{
^
I am new to writing if statements in Java.

New Topic/Question
Reply




MultiQuote







|