#output not coming the same when clicked void display the second time

82 messages · Page 1 of 1 (latest)

past fractalBOT
#

This post has been reserved for your question.

Hey @neat epoch! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

neat epoch
#

i just want it to show "insufficent balance" when i set the credit limit more than my balance amount it shows me the output the first time but does not shows it the second time when clicked the second time

snow inlet
#

So when you click the second time it show this?

neat epoch
#

the second time

dusky field
#

what

neat epoch
#

the first time

dusky field
#

so?

neat epoch
#

i dont want it to show whole detail if my credit limit is more than my total balance amount i only want issuficent

#

balance

snow inlet
#

Oh

dusky field
#

Is it a GUI issue or a coding issue, does it work when you just run it? Can you actually calculate the multiplier?

snow inlet
#

Might be a gui issue

dusky field
#

are you the victim?

snow inlet
#

Uhmmm in the set Credit Limit method, you said you want it to send the "credit... sufficient" when CreditLimit is less than 2.5*balance but instead you do the oppisite

dusky field
#

ok

snow inlet
#

Isn't this suppose to be CreditLimit >= (super.getbalanceAmount()*2.5))?

#

And you have issue with capital naming

dusky field
#

@neat epoch what is the issue, GUI or backend?

snow inlet
dusky field
snow inlet
dusky field
snow inlet
#

Really wonder why people like light mode

dusky field
#

Yeah idk, it's kinda wierd

neat epoch
snow inlet
dusky field
#

have you by any chance flipped the operator?

#

e.g. > should be a < or vice-versa

snow inlet
neat epoch
snow inlet
#

Just flipped > to <

#

Or < to >

dusky field
#

Did you write a > b instead of a < b?

neat epoch
#

no i wrote a < b from the first

dusky field
#

send pastebin?

neat epoch
#

public class CreditCard extends BankCard
{

// six attributes for Credit card
private int CVCnumber;
private double CreditLimit;
private double InterestRate;
private String ExpirationDate;
private int GracePeriod;
private boolean isGranted;

//constructor for CreditCard that accepts eight parameters.
public CreditCard(int cardId, String clientName, String issuerBank, String bankAccount, int balanceAmount, int CVCnumber, double InterestRate, String ExpirationDate)
{
  //calling superclass constructor
  super(cardId, bankAccount, balanceAmount, issuerBank);
  setclientName(clientName);
  
  this.CVCnumber= CVCnumber;
  
  this.InterestRate= InterestRate;
  

  this.ExpirationDate= ExpirationDate;
  
  this.isGranted= false;
}
#

//accessor method for each attribute
public int getCVCnumber(){
return this.CVCnumber;
}

public double getInterestRate(){
    return this.InterestRate;
}

public String getExpirationDate(){
    return this.ExpirationDate;
}

public boolean getisGarnted(){
    return this.isGranted;
}

public double CreditLimit(){
    return this.CreditLimit;
}

public int gracePeriod(){
    return this.GracePeriod;
}


// new method for setting the credit limit
public void setCreditLimit(double CreditLimit, int GracePeriod){
    if (CreditLimit <=(super.getbalanceAmount()*2.5)) {
        this.CreditLimit = CreditLimit;
        this.GracePeriod = GracePeriod;
        this.isGranted = true;
    } else {
        System.out.println("Credit Card Balance is isufficient");  
    }
}

//another method for cancelling the credit card
public void cancelCreditCard(){
    this.CreditLimit = 0;
    this.CVCnumber = 0;
    this.GracePeriod = 0;
    this.isGranted = false;
}

//dislay method
public void display(){
    //calling super class 
      if (isGranted) {
        super.display();
        System.out.println("CVC number:" +CVCnumber);
        System.out.println("Interest Rate:" +InterestRate);
        System.out.println("Credit Limit:" +CreditLimit);
        System.out.println("Grace Period:" +GracePeriod);
           
    
      }else{
        super.display();
        System.out.println("CVC number:" +CVCnumber);
        System.out.println("Interest Rate:" +InterestRate);
        
    }
}
subtle rivet
#

@dusky field why do you hate me

dusky field
dusky field
#

if creditlimit > the calculated max then dont show funds

#

pseudo code

subtle rivet
dusky field
#

@neat epoch

neat epoch
#

yes

dusky field
#

can you solve it?

neat epoch
#

nah man

dusky field
#

come on

#

that's no way to think

subtle rivet
neat epoch
#

dont be rude i am new to this

dusky field
#

he left the server

#

get the credt card balance of the user

#

check if its lower than the limit * 2.5

#

if it is then do the thing

#

else dont show the error thingy

#

not difficult

#

how new are you?

neat epoch
#

just a couple days

#

4-5 days maybe

dusky field
#

first programming language?

neat epoch
#

yes

dusky field
#

okay sick

#

how much do you know?

neat epoch
#

oop

#

thats it

dusky field
#

do you know datatypes? booleans, integers, strings, characters, ..?

neat epoch
#

i know bolean, int and string not characters

dusky field
#

characters are strings but only with one character (hence, char)

#

String helloWorld = "Hello";
char h = 'h';

#

you see?

#

ok cool

#

anyways

#

        if (card.getLimit() >= (card.getBalance() * 2.5)) {
            
            System.out.println("You can spend more money!");
            
        } else {
            
            System.out.println("You can't spend more money!");
        }
#

something like this

#

@neat epoch

neat epoch
dusky field
#

do it already

neat epoch
#

Card limit is greater than your total balance amount really

#

U have 500 and ur limit is 1500 relaly