Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: what wrong , please

  1. #1
    Junior Member
    Join Date
    Feb 2018
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default what wrong , please

    import java.util.Scanner;

    public class TestScoresAndGrade {

    public static void main( String [] args ) {


    Scanner scanner = new Scanner( System.in );
    double score1;
    double score2;
    double score3;

    System.out.println( "Please enter the first score" );
    score1 = scanner.nextDouble();

    System.out.println( "Please enter the second score " );
    score2 = scanner.nextDouble();


    System.out.println( "Please enter the third score " );
    score3 = scanner.nextDouble();

    average = ( score1 + score2 + score3 ) / 3;

    if( average < 60 ) {

    System.out.printf( "The average score is: %f. Thats a grade F", average );

    } else if ( average < 70 ){

    System.out.printf( " The average score is: %f. Thats a grade D ", average );

    } else if ( average < 80 ){

    System.out.printf( " The average score is: %f. Thats a grade C ", average );

    } else if ( average < 90 ){

    System.out.printf( " The average score is: %f. Thats a grade B", average );


    } else if ( average <= 100 ){

    System.out.printf( "The average score is: %f. Thats a grade A", average );


    } else {

    System.out.println( "The average score is"+ average +". Thats a invalid average" );


    }

    }


    }

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: what wrong , please

    Why do you think there is something wrong?
    If there are errors, copy the full text of the error message and paste it here.

    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Feb 2018
    Posts
    5
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: what wrong , please

    I'm imagining its something like:

    error: cannot find symbol
        average = ( score1 + score2 + score3 ) / 3;
        ^
    symbol:   variable average
      location: class TestScoresAndGrade

    But thats just a guess. If so I can't find where you defined average.

Similar Threads

  1. What have I done wrong?
    By Kkbob in forum Other Programming Languages
    Replies: 3
    Last Post: September 29th, 2014, 07:07 AM
  2. Replies: 4
    Last Post: March 6th, 2014, 05:14 PM
  3. [SOLVED] Where am I going wrong
    By keepStriving in forum What's Wrong With My Code?
    Replies: 8
    Last Post: October 28th, 2013, 07:45 PM
  4. Where am I going wrong
    By keepStriving in forum Java Theory & Questions
    Replies: 0
    Last Post: May 6th, 2013, 09:56 AM
  5. Something is wrong? Please help.
    By DestinyChick1225 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 29th, 2010, 07:47 AM