0
import java.util.Scanner;

public class THREE{
  public static void main(String args []) {
    Scanner in = new Scanner( System.in);
    String symbol;
    double averagePrice;
    double stockPrice;
    int sum = 0;
    int count = 0;
    final int FLAG = -999;
	char options;

    do {
		System.out.println("Please chose from one of the following menu options: \n C= Clear Date \n \n E = Enter Data \n \n P = Print Data \n \n X = Exit Menu\n");
    	 options = in.nextLine().toUpperCase().charAt( 0);
    	if (options == 'X') {
			 System.out.println("Now exiting program. ");
	}	else {
			switch(options){
		case 'C':
			System.out.println("All Data Cleared");
		break;
		case 'E':
			System.out.println("Enter the stock symbol: ");
			symbol = in.nextLine();
			System.out.println("Enter the prices for this stock, to end enter "+ FLAG + ": ");
			stockPrice = in.nextDouble();
			do{
				stockPrice = in.nextDouble();
				sum += stockPrice;
				++ count;
				in.nextLine();
				averagePrice = (sum/count);
					double min = 1000000;
					double newMin;
					if (stockPrice < min ) {
						newMin = stockPrice;
				} else if (stockPrice > min);
						double max = 0.0;
						double newMax;
					if (stockPrice > max ){
						newMax = stockPrice;
				} else if (stockPrice < max){
				}


					}while (stockPrice != FLAG);
					}while (options != 'X');
			if (options == 'P') {
			System.out.print("Stock Symbol: " + stockSymbol);
			System.out.printf("Maximum Stock Price: $%.2f\n" + newMax);
			System.out.printf("Minimum Stock Price: $%.2f\n" + newMin);
			System.out.printf("Average Stock Price: $%.2f\n" averagePrice);
		}

}
}

I am recieving an error that looks like this:

java:58:reached end of file while parsing

I realize that I have missed either a "{" or "}" somewhere in the program. This is for a class I am taking. I have been staring at the screen for awhile and decided that I need someone else to view the program. Any help you could offer would be greatly appointed.

THANKS SO MUCH!!
Morgan

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by finito
0

Line 39:

else if (stockPrice > min)[B];[/B]
double max = 0.0;
double newMax;

; and no {}

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.