Use decision logic to develop a Java application that determines whether a department store customer has exceeded the credit limit on their charge account.
1. Account number
2. Balance at the beginning of the month
3. Total of all items charged by the customer this month
4. Total of all credits applied to the customer’s account this month
5. Allowed credit limit
The program should accept as input (from dialog boxes) all of these facts as integers, calculate the new balance, display the new balance in a dialog box, and determine whether the new balance exceeds the customer’s credit limit. When the customer is within the limit, the program should produce a dialog box providing the account number on one line and the words “Good Credit” on the second line. When the customer is not within the limit, the program should produce a dialog box providing the account number on one line and the words “Credit limit exceeded” on the second line.
*credit = payment
does it ask me to make java application that dialog box ask # for each variable and produce result or does it ask me to create java program with preset values(like I use my own numbers for each variable, for example, account # = 123, balance at beginning = $372, etc) and program produce result in 2 seperate dialog boxes(1st box shows account # and new balance, 2nd shows whether my credit is good or not)?
This is what my teacher replied.
"You will prompt me for each of the values I listed on the assignment. You will do the calculations, and then provide two separate dialog boxes. The first tells me my balance, the other tells me if I''m under or exceeded my credit limit."
So how am I suppose to start? I already know how to write these but instruction seems very unclear to me.
This is example code I wrote but not sure if this is what this instruction is asking me to do.
import javax.swing.JOptionPane;
import java.text.DecimalFormat;
public class Project4
{
public static void main(String[] args)
{
String inputString;
int account = 1573201; //account number
int beginningBalance = 425; //balance at the beginning of the month
int totalItemCharged = 520; //total of all items charaged by customer this month
int totalCreditApplied = 300; //credit applied
int allowedCreditLimit = 1500; //allowed credit
int newBalance = (totalItemCharged+beginningBalance)-totalCreditApplied; //calculation for new balance
DecimalFormat formatter = new DecimalFormat("#0");
JOptionPane.showMessageDialog(null, "Your account # is " + account + ". Your new balance is $" + formatter.format(newBalance));
if (newBalance < allowedCreditLimit)
JOptionPane.showMessageDialog(null, "Good Credit");
else
JOptionPane.showMessageDialog(null, "Credit limit exceeded");
System.exit(0);
}
} //end Project4