(for the following quistion, i need the java code which contains JOption pleas)
ID: 3631333 • Letter: #
Question
(for the following quistion, i need the java code which contains JOption pleas)(Credit limit calculator) develop a java application that determines whether any of several department-store customers has exceeded the credit limit on a charge account. For each customer, the following facts are available:
• Account number
• balance at the beginning of the month
• total of all items charged by the customer this month
• total of all credits applied to the customer’s account this month
• allowed credit limit.
The program should input all these facts as integers, calculate the new balance (= biginig balance + changes – credits), display the new balance and determine where the new balance exceeds the customer’s credit limit. For those customers shoes credit limit exceeded, the program should display the message “credit limit exceeded”.
Explanation / Answer
import java.util.Scanner;
public class CreditCheck
{
Scanner input = new Scanner( System.in );
// define instance variable
int acctNo = 0;
double shopinitA = 0.0;// initial balance
double shopcharges = 0.0; // charges applied to user's acct
double shopcredits = 0.0; // credits applied to user's acct
double shopcreditlimit = 0.0; // user's acct limit
double newbal = 0.0; //user's ;calculated balance
double positivecredit = 0.0; // money left to spend
double negativecredit = 0.0; // amount of money overdrawn
String msg = "";
public CreditCheck()
{
}
//acct number based on user's ;input
public void setAccountNumber (int acctNo)
{
acctNo = acctNo;
}
//method for initial balance on user's input
public void setInitialBalance (double initA)
{
shopinitA = initA;
}
// method to establish total charges based on user's input
public void setTotalCharges (double charges)
{
shopcharges = charges;
}
// method establishes total credits based on user's input
public void setTotalCredits (double credits)
{
shopcredits = credits;
}
//method establishes total credit based on user's input
public void setCreditLimit (double ;creditLimit)
{
shopcreditlimit = creditLimit;
}
// balance calculation and results
public void showResult()
{
//calculate balance
newbal = (shopinitA + shopcharges)- shopcredits;
positivecredit = shopcreditlimit - ;newbal;
negativecredit = shopcreditlimit - ;(newbal);
//user balance options
if ( newbal < 0 )
System.out.print( "Your balance is ;$" + newbal +"(positivecredit)to spend.");
else if ( positivecredit >=0 )
System.out.print( "Your balance is ;$"+ newbal + " and you ;still have $");
else
System.out.println ("Credit Limit exceeded" );
}
}
This should do it...... You may get some errors.... May be due to incompetancy.... So Please Check them out Urself. Thanks and Cheers!!! :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.