Results 1 to 2 of 2
Thread: Question with code
- 04-03-2012, 10:02 PM #1
Member
- Join Date
- Apr 2012
- Posts
- 13
- Rep Power
- 0
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!
- 04-03-2012, 10:22 PM #2
Senior Member
- Join Date
- Oct 2011
- Posts
- 106
- Rep Power
- 0
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
-
Question about the meaning of some code.
By silverglade in forum New To JavaReplies: 14Last Post: 04-29-2011, 08:26 PM -
question regarding thread code
By afx111 in forum New To JavaReplies: 1Last Post: 02-01-2011, 07:39 AM -
Question about my code (double, int)
By Intermission in forum New To JavaReplies: 7Last Post: 02-22-2010, 01:24 PM -
Quick question about this simple code..
By shroomiin in forum New To JavaReplies: 2Last Post: 11-10-2009, 05:58 PM -
need a java code for this question!
By rose in forum New To JavaReplies: 3Last Post: 05-07-2008, 07:34 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks