dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Cannot Find Symbol error

  1. #1
    Join Date
    Feb 2008
    Location
    Manassas, VA
    Posts
    5

    Question Cannot Find Symbol error

    Why does it keep saying "Cannot find symbol. Symbol: Class DoubleClass" every time I try to compile?

    Code:
    import java.io.*;
    import java.util.*;
    
    public class AverageScores
    {
       public static void main (String[] args)
    										throws FileNotFoundException
                                 
      	{
    		double test1, test2, test3, test4, test5;
    		String name;
    		char grade;
    		
    		DoubleClass average = new DoubleClass();
    		
    		Scanner inFile = new Scanner(new FileReader("student_scores.txt"));
    		
    		PrintWriter outFile = new PrintWriter("student_scores.out");
    		
    		outFile.println("Student    Test1 Test2 Test3 Test4 Test5 Average Grade");
    		
    		while (inFile.hasNext())
    		{
    			name = inFile.next();
    			test1 = inFile.nextDouble();
    			test2 = inFile.nextDouble();
    			test3 = inFile.nextDouble();
    			test4 = inFile.nextDouble();
    			test5 = inFile.nextDouble();
    			calculateAverage(inFile, average);
    			average.getNum();
    						
    			outFile.printf("%-9s %5.0f %5.0f %5.0f %5.0f %5.0f %6.2f %n",
    								name, test1, test2, test3, test4, test5, average);
    
    		}		
    		
    		inFile.close();
    		outFile.close();
    	}
    	
    	public static void calculateAverage(DoubleClass average, double t1, double t2, double t3, double t4, double t5)
    	
    	{
    		average.setNum((t1 + t2 + t3 + t4 + t5) / 5.0);
    	}
    	
    	public static double calculateGrade(double average)
    	
    	{
    		if (average >= 90)
    			return 'A';
    		else if (average >= 80)
    			return 'B';
    		else if (average >= 70)
    			return 'C';
    		else if (average >= 60)
    			return 'D';
    		else
    			return 'F';
    	}
    }

  2. #2
    Join Date
    Dec 2006
    Posts
    166

    Re: Cannot Find Symbol error

    well, what the hell is "DoubleClass"?

  3. #3
    Join Date
    Feb 2008
    Location
    Manassas, VA
    Posts
    5

    Re: Cannot Find Symbol error

    It says in my book "DoubleClass is used so values of the double type can be wrapped in an object. The class DoubleClass also provides methods to change the value of an DoubleClass object. We use reference variables of the DoubleClass type to pass double values outside a method."

    I refered to an example program in the book to figure out how to use it, and they use it the same way I did.

  4. #4
    Join Date
    Dec 2006
    Posts
    166

    Re: Cannot Find Symbol error

    well, maybe they implement that class somewhere in the book; and then you would have to put the class in the same directory as this file

  5. #5
    Join Date
    Mar 2008
    Posts
    9

    Re: Cannot Find Symbol error

    I think you're looking for Double

  6. #6
    Join Date
    Apr 2007
    Posts
    442

    Re: Cannot Find Symbol error

    Possible that you have some online repository from where you can download this dubious class. If not, and it is not supplied in any other digital means, youŽll have to type down the class yourself, to represent the one you have in your book.

    Next youŽll only need to check, that the path you provide in your import declaration matches the actual location of the class. If it doesnt, music wont play.

    Beats me what actual need for a DoubleClass there is, I mean you allready have wrapper class in Double. Can you perhaps say what is the gracious common good that this DoubleClass intoduces? You have not been the first one asking this very same.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)