Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Cash Register Simulation Help

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Thanked 0 Times in 0 Posts

    Default Cash Register Simulation Help

    Hello, I am having trouble figuring out how to simulate a cash register that accepts cash, credit cards, and checks. We did not learn about verification yet so no need for credit card verification. I do know that we need "if and else" statements but I'm not quite sure how to go about doing that. I'm thinking of having the if statement be "choice = cash" but I'm not sure where to go from there. I also need help with the methods I'll need. I need to be able to add up the total amount of the purchases, ask what the customer wants to pay with. Have one of the payments be cash then the rest on the credit card. Then give amount still owed(if applicable). Any help would be appreciated. I'm a total noob to java.


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    My Mood
    Thanked 263 Times in 232 Posts

    Default Re: Cash Register Simulation Help

    Hi Gont
    It looks like you understand the problem to be solved. The next step would be to decide how to solve the problem. So now is not the time to worry about needing if else statements or "choice = cash". But while we are on the topic of "choice = cash" be sure to use == to compare instead of =, and use .equals with strings.

    So without thinking about code, write down how you will be able to solve the problem.
    Then go back over the solution to the problem and make sure it solves the problem without breaking any of the rules.

    Once you get that done, all you have to do is translate to code. That will determine when/if you need if/else statements and if "choice == cash" or not

Similar Threads

  1. bit array and register problem
    By ryu2le in forum What's Wrong With My Code?
    Replies: 35
    Last Post: August 31st, 2011, 10:52 PM
  2. cash drawer
    By lephoe in forum Java SE APIs
    Replies: 9
    Last Post: April 20th, 2010, 08:53 PM
  3. Cash Register Exercise
    By Consus in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 19th, 2010, 11:52 PM
  4. Simple Program for Cash
    By javastudent in forum Paid Java Projects
    Replies: 9
    Last Post: December 1st, 2009, 07:25 AM