import java.util.*;
public class enrollment{
public static void main(String[]args){
int balance, payment;
balance = 20000;
String partial = "partial";
String full = "full";
System.out.print("\nEnter Name: ");
Scanner st = new Scanner(System.in);
String name = st.nextLine();
System.out.print("\nYour Remaining Balance is: "+balance);
System.out.print("\nChoose your Payment term(Partial/Full): ");
String term = st.nextLine();
if(term == partial){
System.out.print("\nHow much would you like to pay for this quarter: ");
Scanner in = new Scanner(System.in);
payment = in.nextInt();
balance = balance - payment;
System.out.print("\nYour Balance is: "+ balance);
if(balance > payment){
System.out.print("\nYou have remaining balance of: " + balance);
}else if(balance == payment){
System.out.print("You are already paid");
}
}
}
}
I've been doing this for a week, I always tend to search for some alternative solution, but still it doesn't fit to my program, whenever I answer this question:
System.out.print("\nChoose your Payment term(Partial/Full): ");
String term = st.nextLine();
it always execute to the end.
I don't know what is wrong about my If condition because I already declare partial as "partial" so I assume that it will take partial and execute the statement. Just need some advice so I can finish the program until to the end at full payment. Any suggestion is deeply appreciated.

New Topic/Question
Reply



MultiQuote





|