import java.io.*;
public class DCS2{
	public static void main (String [] args)
		throws IOException{
			BufferedReader myInput = new BufferedReader (new InputStreamReader(System.in));
			int code, al, nmp, brc;
			float tf = 0 , ir = 0;
			String name = "" , description = "";
			System.out.println ("Enter Your Barrower's Name");
			name = myInput.readLine();
			System.out.println("Enter Your Amount Loan");
			al = Integer.parseInt(get.readLine());
			System.out.println("Enter No. Of Months to Pay");
			nmp = Integer.parseInt(get.readLine());
			System.out.println("Enter Barrowers Rank code [ A - B]");
			code = Integer.parseInt(myInput.readLine());
			switch (code){
				case A:
					description = "SENIOR";
			if (al >= 10001)
				ir = .075;
				i = al*ir*nmp;
				ma = ad/nmp;
			else if ((al < 10000) && (al >= 6001))
				ir = .06;
				i = al*ir*nmp;
				ma = ad/nmp;
			else if ((al < 6000) && (al >= 3001))
			    ir = .045;
				i = al*ir*nmp;
				ma = ad/nmp;
			else if (al > 3000)
				ir = .03;
				i = al*ir*nmp;
				ma = ad/nmp;
		    else
					break;
				case B:
					description = "JUNIOR";
			if (al >= 10001)
				ir = .085;
				i = al*ir*nmp;
				ma = ad/nmp;
			else if ((al < 10000) && (al >= 6001))
				ir = .07;
				i = al*ir*nmp;
				ma = ad/nmp;
			else if ((al < 6000) && (al >= 3001))
			    ir = .055;
				i = al*ir*nmp;
				ma = ad/nmp;
			else if (al > 3000)
				ir = .04;
				i = al*ir*nmp;
				ma = ad/nmp;
		    else
					break;
				default:
					System.out.println("A or B only");
					break;
							}
							System.out.println("Barrower's Name: " + name);
							System.out.println("Rank Description : " + description);
							System.out.println("Amount Loan: " + al);
							System.out.println("Interest: " + i);
							System.out.println("Amount Due: " + ad);
							System.out.println("Monthly Amortization: " + ma);

		}
}

--------------------Configuration: <Default>--------------------
C:\Users\asus\Documents\Comsys\DCS2.java:24: 'else' without 'if'
else if ((al < 10000) && (al >= 6001))
^
C:\Users\asus\Documents\Comsys\DCS2.java:28: 'else' without 'if'
else if ((al < 6000) && (al >= 3001))
^
C:\Users\asus\Documents\Comsys\DCS2.java:32: 'else' without 'if'
else if (al > 3000)
^
C:\Users\asus\Documents\Comsys\DCS2.java:36: 'else' without 'if'
else
^
C:\Users\asus\Documents\Comsys\DCS2.java:44: 'else' without 'if'
else if ((al < 10000) && (al >= 6001))
^
C:\Users\asus\Documents\Comsys\DCS2.java:48: 'else' without 'if'
else if ((al < 6000) && (al >= 3001))
^
C:\Users\asus\Documents\Comsys\DCS2.java:52: 'else' without 'if'
else if (al > 3000)
^
C:\Users\asus\Documents\Comsys\DCS2.java:56: 'else' without 'if'
else
^
8 errors

Process completed.

Using JOptionPane code.

import javax.swing.io.*;
public class DCS2b{
	public static void main (String [] args){
			int code, al, nmp, brc;
			float tf = 0 , ir = 0;
			String name = "" , description = "";
			name = JOptionPane.showInputDialog("Enter Your Barrower's Name");
	        al = JOptionPane.showInputDialog("Enter Your Amount Loan");
			nmp = JOptionPane.showInputDialog("Enter No. Of Months to Pay");
			code = Integer.parseInt(JOptionPane.showInputDialog("Enter Barrowers Rank code [ A - B]"));
			switch (code){
				case A:
					description = "SENIOR";
			if(al >= 10001)
				ir = .075;
				i = al*ir*nmp;
				ma = ad/nmp;
			else if ((al < 10000) && (al >= 6001))
				ir = .06;
				i = al*ir*nmp;
				ma = ad/nmp;
			else if ((al < 6000) && (al >= 3001))
			    ir = .045;
				i = al*ir*nmp;
				ma = ad/nmp;
			else if (al > 3000)
				ir = .03;
				i = al*ir*nmp;
				ma = ad/nmp;
		    else
					break;
				case B:
					description = "JUNIOR";
			if(al >= 10001)
				ir = .085;
				i = al*ir*nmp;
				ma = ad/nmp;
			else if ((al < 10000) && (al >= 6001))
				ir = .07;
				i = al*ir*nmp;
				ma = ad/nmp;
			else if ((al < 6000) && (al >= 3001))
			    ir = .055;
				i = al*ir*nmp;
				ma = ad/nmp;
			else if (al > 3000)
				ir = .04;
				i = al*ir*nmp;
				ma = ad/nmp;
		    else
					break;
				default:
					System.out.println("A or B only");
					break;
							}
							JOptionPane.showMessageDialog(null, "Hello " + name + "!", "name", "Rank Description : " + description , "description" , "Amount Loan: " + al , "al", "Interest: " + i , "i", "Amount Due: " + ad , "ad", "Amount Due: " + ad , "ad" , "Monthly Amortization: " + ma, "ad",JOptionPane.PLAIN_MESSAGE);

		}
}

--------------------Configuration: <Default>--------------------
C:\Users\asus\Documents\Comsys\DCS2b.java:18: 'else' without 'if'
else if ((al < 10000) && (al >= 6001))
^
C:\Users\asus\Documents\Comsys\DCS2b.java:22: 'else' without 'if'
else if ((al < 6000) && (al >= 3001))
^
C:\Users\asus\Documents\Comsys\DCS2b.java:26: 'else' without 'if'
else if (al > 3000)
^
C:\Users\asus\Documents\Comsys\DCS2b.java:30: 'else' without 'if'
else
^
C:\Users\asus\Documents\Comsys\DCS2b.java:38: 'else' without 'if'
else if ((al < 10000) && (al >= 6001))
^
C:\Users\asus\Documents\Comsys\DCS2b.java:42: 'else' without 'if'
else if ((al < 6000) && (al >= 3001))
^
C:\Users\asus\Documents\Comsys\DCS2b.java:46: 'else' without 'if'
else if (al > 3000)
^
C:\Users\asus\Documents\Comsys\DCS2b.java:50: 'else' without 'if'
else
^
8 errors

Process completed.

Put the body of your if statements in curly braces.

if(al >= 10001)   
				ir = .075;  // this line is the only one in the if
				i = al*ir*nmp; // this always executes
				ma = ad/nmp;   // so does this
			else if ((al < 10000) && (al >= 6001)) //this is an error
				ir = .06;
				i = al*ir*nmp;
				ma = ad/nmp;

There's probably other problems, but that's the most obvious.
Oh, and learn to read the compiler output. "else without if" means look at your else statements and see why they don't have ifs to go with them.

please fix it. always error..

jon.kiparsky has already solved your errors. Read his suggestions and your error messages.
You have an else without an if.
It is:

if () 
  one command;
else
  one command;

For multiple commands use {}

When you don't put {} at the if, only the first line after the if is taken into account. The rest are considered outside the if. Then you put an else that doesn't have an if before it, because the if you had, has other commands between them that don't belong to the if so they are not connected.

As a new programmer, always try to use braces in if statement or in loop. It is a good programming habit and it helps to debug error easily and the program is more readable.

jon.kiparsky has already solved your errors. Read his suggestions and your error messages.
You have an else without an if.
It is:

if () 
  one command;
else
  one command;

For multiple commands use {}

When you don't put {} at the if, only the first line after the if is taken into account. The rest are considered outside the if. Then you put an else that doesn't have an if before it, because the if you had, has other commands between them that don't belong to the if so they are not connected.

import java.io.*;
public class DCS2{
	public static void main (String [] args)
		throws IOException{
			BufferedReader myInput = new BufferedReader (new InputStreamReader(System.in));
			int code, al, nmp, brc, i ,ma, ad, ir;
			String name = "" , description = "";
			System.out.println ("Enter Your Barrower's Name");
			name = myInput.readLine();
			System.out.println("Enter Amount Loan");
			al = Integer.parseInt(myInput.readLine());
			System.out.println("Enter No. Of Months to Pay");
			nmp = Integer.parseInt(myInput.readLine());
			System.out.println("Enter Barrowers Rank code [ 1 - 2]");
			code = Integer.parseInt(myInput.readLine());
			switch (code){
				case 1:
					description = "SENIOR";
			if(al >= 10001){
				ir = .075;  // this line is the only one in the if
				i = al*ir*nmp; // this always executes
				ma = ad/nmp;   // so does this
			}

			else if ((al < 10000) && (al >= 6001)){ //this is an error
				ir = .06;
				i = al*ir*nmp;
				ma = ad/nmp;}
			else if ((al < 6000) && (al >= 3001)){
				 ir = .045;
				i = al*ir*nmp;
				ma = ad/nmp;
			}	else if (al > 3000){
				ir = .03;
				i = al*ir*nmp;
				ma = ad/nmp;
			}else

					break;
				case 2:
					description = "JUNIOR";
			if(al >= 10001){
				ir = .085;
				i = al*ir*nmp;
				ma = ad/nmp;}
			else if ((al < 10000) && (al >= 6001)){
				ir = .07;
				i = al*ir*nmp;
				ma = ad/nmp;}
			else if ((al < 6000) && (al >= 3001)){
			    ir = .055;
				i = al*ir*nmp;
				ma = ad/nmp;}
			else if (al > 3000){
				ir = .04;
				i = al*ir*nmp;
				ma = ad/nmp;}
            else
					break;
				default:
					System.out.println("A or B only");
					break;
							}

							System.out.println("Barrower's Name: " + name);
							System.out.println("Rank Description : " + description);
							System.out.println("Amount Loan: " + al);
							System.out.println("Interest: " + i);
							System.out.println("Amount Due: " + ad);
							System.out.println("Monthly Amortization: " + ma);

		}
}

--------------------Configuration: <Default>--------------------
C:\Users\asus\Documents\Comsys\DCS2.java:21: possible loss of precision
found : double
required: int
ir = .075; // this line is the only one in the if
^
C:\Users\asus\Documents\Comsys\DCS2.java:27: possible loss of precision
found : double
required: int
ir = .06;
^
C:\Users\asus\Documents\Comsys\DCS2.java:31: possible loss of precision
found : double
required: int
ir = .045;
^
C:\Users\asus\Documents\Comsys\DCS2.java:35: possible loss of precision
found : double
required: int
ir = .03;
^
C:\Users\asus\Documents\Comsys\DCS2.java:44: possible loss of precision
found : double
required: int
ir = .085;
^
C:\Users\asus\Documents\Comsys\DCS2.java:48: possible loss of precision
found : double
required: int
ir = .07;
^
C:\Users\asus\Documents\Comsys\DCS2.java:52: possible loss of precision
found : double
required: int
ir = .055;
^
C:\Users\asus\Documents\Comsys\DCS2.java:56: possible loss of precision
found : double
required: int
ir = .04;
^
8 errors

Process completed.

Read the error output. ir is a double, so any arithmetic expression involving ir returns a double. i is an int, so you can't assign a double into it. You have to either make that product into an int or declare i as a double. What you do will depend on what your code requires.

There are various functions that take doubles and return ints, look through the Math class and see which one might suit your needs.

You have declared the variables as int and assigned double values to them.
Declare them as double variables.

Also you do this:

ma = ad/nmp;
}
else
 break;

which is wrong.
After the else you put commands. The break belongs to the switch, not the if-else statement. With the way you have it, the break will execute only after the else. If the first 'if' is true then the break will not execute because the way you have it, it belongs to the if. The else that you have there does nothing so it is not needed.

And what is so hard to understand from this:
"Found double. Requires int" followed by the line of the code.

please recode to fix it.. is hard to code this.. huhu

import java.io.*;
public class DCS2{
	public static void main (String [] args)
		throws IOException{
			BufferedReader myInput = new BufferedReader (new InputStreamReader(System.in));
			int code, al, nmp, brc ,ma, ad;
			double i, ir;
			String name = "" , description = "";
			System.out.println ("Enter Your Barrower's Name");
			name = myInput.readLine();
			System.out.println("Enter Amount Loan");
			al = Integer.parseInt(myInput.readLine());
			System.out.println("Enter No. Of Months to Pay");
			nmp = Integer.parseInt(myInput.readLine());
			System.out.println("Enter Barrowers Rank code [ 1 - 2]");
			code = Integer.parseInt(myInput.readLine());
			switch (code){
				case 1:
					description = "SENIOR";
			if(al >= 10001){
				ir = .075;  // this line is the only one in the if
				i = al*ir*nmp; // this always executes
				ma = ad/nmp;   // so does this
			}

			else if ((al < 10000) && (al >= 6001)){ //this is an error
				ir = .06;
				i = al*ir*nmp;
				ma = ad/nmp;}
			else if ((al < 6000) && (al >= 3001)){
				 ir = .045;
				i = al*ir*nmp;
				ma = ad/nmp;
			}	else if (al > 3000){
				ir = .03;
				i = al*ir*nmp;
				ma = ad/nmp;
			}else

					break;
				case 2:
					description = "JUNIOR";
			if(al >= 10001){
				ir = .085;
				i = al*ir*nmp;
				ma = ad/nmp;}
			else if ((al < 10000) && (al >= 6001)){
				ir = .07;
				i = al*ir*nmp;
				ma = ad/nmp;}
			else if ((al < 6000) && (al >= 3001)){
			    ir = .055;
				i = al*ir*nmp;
				ma = ad/nmp;}
			else if (al > 3000){
				ir = .04;
				i = al*ir*nmp;
				ma = ad/nmp;}
            else
					break;
				default:
					System.out.println("A or B only");
					break;
							}

							System.out.println("Barrower's Name: " + name);
							System.out.println("Rank Description : " + description);
							System.out.println("Amount Loan: " + al);
							System.out.println("Interest: " + i);
							System.out.println("Amount Due: " + ad);
							System.out.println("Monthly Amortization: " + ma);

		}
}

--------------------Configuration: <Default>--------------------
D:\My Documents\ComSys\DCS2.java:23: variable ad might not have been initialized
ma = ad/nmp; // so does this
^
D:\My Documents\ComSys\DCS2.java:29: variable ad might not have been initialized
ma = ad/nmp;}
^
D:\My Documents\ComSys\DCS2.java:33: variable ad might not have been initialized
ma = ad/nmp;
^
D:\My Documents\ComSys\DCS2.java:37: variable ad might not have been initialized
ma = ad/nmp;
^
D:\My Documents\ComSys\DCS2.java:46: variable ad might not have been initialized
ma = ad/nmp;}
^
D:\My Documents\ComSys\DCS2.java:50: variable ad might not have been initialized
ma = ad/nmp;}
^
D:\My Documents\ComSys\DCS2.java:54: variable ad might not have been initialized
ma = ad/nmp;}
^
D:\My Documents\ComSys\DCS2.java:58: variable ad might not have been initialized
ma = ad/nmp;}
^
D:\My Documents\ComSys\DCS2.java:69: variable i might not have been initialized
System.out.println("Interest: " + i);
^
D:\My Documents\ComSys\DCS2.java:70: variable ad might not have been initialized
System.out.println("Amount Due: " + ad);
^
D:\My Documents\ComSys\DCS2.java:71: variable ma might not have been initialized
System.out.println("Monthly Amortization: " + ma);
^
11 errors

Process completed.

Do you even bother to read the error messages that you get? They state the error and the line that it occurred.
"DCS2.java:29: variable ad might not have been initialized"
What you don't understand from that. Is it so difficult to go and initialize the variable ad ?

Also there are some other errors that you have been told how to fix them:

else if (..) {

} else
   break;

That may compile but is wrong. You need the break to execute when the if statements finish. With what you write, the break will execute only inside the last "else". If you enter any of the other ifs, the break will not execute. The last "else" is not necessary since you haven't put any commands inside.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.