| | |
Help with java prog...!
![]() |
•
•
Join Date: Feb 2003
Posts: 35
Reputation:
Solved Threads: 2
Gah. I wrote all this code thnking that it would work properly, but it doesn't.
I need the program to find the largest increase in the 10 numbers inputted by the user, what the difference actually was, and when it happened (i.e., bet. day 4 and 5)
Any ideas? Its due TONIGHT!!
Java Syntax (Toggle Plain Text)
//#13 //Reads N days worth of stock prices,and spits out the highest increase. //Created 6/30/03, 8:38 PM class StockWatcher { public static void main (String args []) { double today = 0.00; //price of stock today double yesterday; //price of stock yesterday //EDIT "days" TO CAHNGE THE AMOUNT OF DAYS YOU WANT THE PROGRAM TO ANALYZE. Default is 10 final int days = 10; double everything = 0.00; // sum of everything boolean goingup = true; //t/f value when price goes up. Original default at t double highest = 0.00; //current highest value double yhighest = 0.00; //highest from yesterday double uberhighest = 0.00; //overall highest value double minusdays = 0.00; //today - yesterday System.out.println ("Welcome, day trader."); System.out.println ("Enter values for " + days + " days worth of stock."); for (int i = 1; i <= days; i++) { yesterday = today; //remember's the price from yesterday today = SavitchIn.readDouble(); //collects today's value everything += today; //changes value of price to keep updated if (today < yesterday) { goingup = false; } if (today > yesterday) { minusdays = (today - yesterday); if (minusdays > highest) { uberhighest = minusdays; } } } System.out.println ("The highest difference between the stock values was $" + uberhighest + "."); } }
I need the program to find the largest increase in the 10 numbers inputted by the user, what the difference actually was, and when it happened (i.e., bet. day 4 and 5)
Any ideas? Its due TONIGHT!!
![]() |
Similar Threads
- Calculate Dialed/Received call timer logs(cellphone) (Java)
- Help in writing a litle program for a friend (Java)
- jdb run time input needed (Java)
- how to add swf file as JButton (Java)
- Need Help >> I Give Up , Cant Do This Program :'((( (Java)
- how to access variable outside awk and spliting the string in array (Shell Scripting)
- Sound Programming ?? Need your help (C++)
- Need help with java prog (Java)
Other Threads in the Java Forum
- Previous Thread: Loop...without the loop
- Next Thread: Notepad VS. Something Else
| Thread Tools | Search this Thread |
-xlint actionlistener add android applet application array automation bank bi binary blackberry block bluetooth character class client code compile compiler component consumer database desktop developmenthelp eclipse equation error event fractal ftp functiontesting game gameprogramming givemetehcodez graphics gui health html hyper idea image infinite int j2me j2seprojects java javac javaee javame javaprojects jetbrains jni jpanel jtable julia learningresources lego linked linux mac main method mobile myregfun netbeans notdisplaying number online pearl printf problem program qt researchinmotion rotatetext rsa scanner screen server set singleton sms sort spamblocker sql string swing system textfields thread threads time title tree tutorial-sample update variablebinding windows xor





