Results 1 to 2 of 2
  1. #1
    maximumammo is offline Banned
    Join Date
    Apr 2012
    Posts
    13
    Rep Power
    0

    Default Question with code

    I am writing a code that has users enter their name, phone number, and amount spent at a grocery store, one the users have entered that information how would I have the program find the biggest spender and display their corresponding info? I know how to find the largest amount of money spent but I dont know how to have the program pull up the rest of the info. Below is an example.

    ------------------------------------------------------------
    Welcome, Please enter your information,


    Joe Smith, 111-111-1111, $89.55
    Joe Smith Jr, 222-222-2222, $55.40
    Joe Smith Sr, 333-333-3333, $75.10
    Mrs. Joe Smith, 444-444-4444, $210.00

    The Winner is Ms. Joe Smith, 444-444-4444, $210.00

    -------------------------------------------------------------

    Any help is appreciated, thanks!

  2. #2
    mwr1976 is offline Senior Member
    Join Date
    Oct 2011
    Posts
    106
    Rep Power
    0

    Default Re: Question with code

    The best advice I ca give you is when presented with and problem is first pull out a piece of paper. I always do. First write out the requirements in your own words. Then write out the things you may not know how to figure out. Next make a list of the things that you need as input and what you expect as output. Do this in all just normal English and math terms no Java terms. Then I write out a list in order using pseudo code. Like:

    if this person spends more than this person then he is a bigger spender.
    Then you can re-factor : if one person spending > than person two , bigger spender = person one etc.

    some times it is easier to "funnel" down to your solution.

    This is the time to ask questions research on the web on how to do things you don't know how to do. Then construct your code. The biggest value besides breaking your large problem down into smaller problems is that then you can post your code to the forum and be able to ask a specific question. Your learning will be accelerated and you will find over time you will establish a workflow where you will be able to figure out more of your own solutions.


    hope this helps!

Similar Threads

  1. Question about the meaning of some code.
    By silverglade in forum New To Java
    Replies: 14
    Last Post: 04-29-2011, 09:26 PM
  2. question regarding thread code
    By afx111 in forum New To Java
    Replies: 1
    Last Post: 02-01-2011, 08:39 AM
  3. Question about my code (double, int)
    By Intermission in forum New To Java
    Replies: 7
    Last Post: 02-22-2010, 02:24 PM
  4. Quick question about this simple code..
    By shroomiin in forum New To Java
    Replies: 2
    Last Post: 11-10-2009, 06:58 PM
  5. need a java code for this question!
    By rose in forum New To Java
    Replies: 3
    Last Post: 05-07-2008, 08:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •