/*manimbo_mp4.java*/
import java.io.*;
	public class manimbo_mp4{
		public static void main (String[]args) throws IOException{
			BufferedReader br=new BufferedReader (new InputStreamReader (System.in));
			
			/*initializing STRING FORMAT variables
			 *smmort holds monthly mortgage amount
			 *spaym holds mortgage payment amount
			 *sremb holds principal amount*/
			String smmort,spaym,sremb;
			
			/*initializing LONG FORMAT variables
			 *lmmort holds monthly mortgage amount
			 *lpaym holds mortgage payment amount
			 *loutb holds outstanding balance
			 *lremb holds principal amount*/
			Long lmmort,lpaym,loutb,lremb;
			
			/*initializing DOUBLE FORMAT variables
			 *doutb holds outstanding balance
			 *dremb holds principal amount
			 *dinte holds interest amount*/
			Double doutb,dremb,dinte;
			
			/*prints "Enter Monthly Mortgage Amount: " on sreen and asks for input from user*/
			System.out.print ("Enter Monthly Mortgage Amount: ");
			/*assigns smmort to hold the inputted data from user*/
			smmort=br.readLine();
			/*converts smmort value to Long Format*/
			lmmort=Long.parseLong(smmort);
			
			/*prints "Enter Mortgage Payment Amount: " on screen and asks for input from user*/
			System.out.print ("Enter Mortgage Payment Amount: ");
			/*assigns spaym to hold the inputted data from user*/
			spaym=br.readLine();
			/*converts spaym value to Long Format*/
			lpaym=Long.parseLong(spaym);
			
			/*if statement*/
			/*determines if mortgage payment is greater than the monthly mortgage amount*/
			if (lpaym>lmmort){
				/*assigns loutb to hold the change if there is any*/
				loutb=lpaym-lmmort;
				/*determines if there is a change*/
				if (loutb>0){
					/*prints the amount of change on screen*/
					System.out.println ("Change: " + loutb);
				}
				/*determines if the customer gave an exact amount of payment*/
				else{
					/*SHOULD PRINT "Exact Amount of Payment Received" BUT ON MY CASE, IT DOES NOT*/
					System.out.println ("Exact Amount of Payment Received");
				}
			}
			else if (lpaym<lmmort){
				lremb=lmmort-lpaym;
				System.out.println ("Principal Amount: " + lremb);
				sremb=String.valueOf(lremb);
				dremb=Double.parseDouble(sremb);
				dinte=(dremb*(7.49/12));
				doutb=dinte+dremb;
				System.out.println ("Interest Amount: " + dinte);
				System.out.println ("Outstanding Balance: " + doutb);
			}

		}
	}

Finally know the answer... I was hungry a while ago so I ate some. Then I came to realize that the condition

if (lpaym>lmmort)

is the reason why it does not print "Exact amount of payment received".

Edited 7 Years Ago by aladar04: n/a

This question has already been answered. Start a new discussion instead.