Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6935749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:08:36+00:00 2026-05-27T12:08:36+00:00

I just have a small beginners question, and it’s about the code below. I

  • 0

I just have a small beginners question, and it’s about the code below. I want to check if the amount that the customer deduct from a credit account + the current balance don’t getting lower than -5000 ? It’s not working, and I’m wondering what I have done wrong? Is it about negative values? Help preciated!

// deduct credit account
if(type == "credit") {
    if((amountOut + creditAccountList.get(index).getAccountBalance()) < -5000) {
       System.out.println("Sorry! No deduct");
    }
}

EDIT:
The amountOut is a positive number that the customer enters. I still don’t get it to work!? Could it be done in some other way? It seems so simple, byt yet so comlicated for me right now! I just want to prevent the customer to deduct a value if the balance is -5000? The problem is that the balance is a negative number.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:08:37+00:00Added an answer on May 27, 2026 at 12:08 pm

    I think you have to rewrite the condition. If I understood your case is the customer can withdraw an 5000 more than that of diposited amount. Example If customer has balance of 2000rs he/she can withdraw maximum 7000 rupees. If he/she wants to withdraw morw then your application will show “Sorry! No deduct” message. If this is the case then you can re-write the logic as given below

    int thresholdMoney = 5000;
            if(((creditAccountList.get(index).getAccountBalance()+ thresholdMoney) - Math.abs(amountOut)) < 0){
                System.out.println("Sorry! No deduct");
    
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just have a small question that I would like some clarification about, if
I am new to Shell script. Just have a small question about some script
I have a small flash file that just loads and shows one image scaled
I have MANY small Test Projects where I put together just enough code to
I am just new to programming in Unix and have a small issue that
Just a small question regarding joins. I have a table with around 30 fields
I am designing a Point-Of-Sale system for a small shop. The shop just have
I have just become the only IT manager of a small business. We have
I have just started programming and have made a few small applications in C
I have a small website developed using VS2005 and mySQl, it's just 2 webforms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.