Gah. I wrote all this code thnking that it would work properly, but it doesn't.

//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
		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 &#40;int i = 1; i <= days; i++&#41;
			yesterday = today; //remember's the price from yesterday

			today = SavitchIn.readDouble&#40;&#41;; //collects today's value
			everything += today; //changes value of price to keep updated
			if &#40;today < yesterday&#41;
				goingup = false;
			if &#40;today > yesterday&#41;
				minusdays = &#40;today - yesterday&#41;;
				if &#40;minusdays > highest&#41;
					uberhighest = minusdays;
		System.out.println &#40;"The highest difference between the stock values was $" + uberhighest + "."&#41;;

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!!

Re: Help with java prog...! 80 80

Please explain what happens when you compile and execute the program.
Do you get errors? If so copy the full text and paste here.
Is the output from the programn wrong? If so copy the console from when you execute the code and paste it here and add some comments describing what the output should be.

Please fix the posted code. It is full of special characters: &#40; that are not valid java.

Re: Help with java prog...! 80 80

Norm - did you check the date?
(I deleted the spam post this morning)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.