-2
class Targil1 {

    public static void main(string[] args) {

        int score1, score2, score3, avg1, avg2, avg3;

        System.out.println("enter 3 scores");

        score1 = reader.nextInt();
        score2 = reader.nextInt();
        score3 = reader.nextInt();

        avg1 = (score1 + score2) / 2;
        avg2 = (score1 + score3)/2;
        avg3 = (score2 + score3) / 2;

        if (score1 > score3 && score2 > score3) {
            if (score3 > 60) ;

            avg1 += 5;

            System.out.println(avg1 + "average");
        }

        if (score3 > score2 && score1 > score2) {

            if (score1 > 60) ;

            avg2 += 5;

            System.out.println(avg2 + "average");
        }

        if (score2 > score1 && score3 > score1) {
            if (score1 > 60) ;
            avg3 += 5;
            System.out.println(avg3 + "average");
        }
    }
}

in the "string args" part it says "cannot find symbol -class string"

in the java import one it says "cannt find symbol -class scanner"

in the 3 score x= it says cannot find variable reader and in

avg2 it says cannot find variable score1

This is a simple question from a teacher, the question is: A teacher decided to calculate the average of her students only from their 2 highest scores, and if the 3rd one (the lowest) is above 60 they also get a +5 to what their 2 higher scores is

for some reason the site doesnt understand some of the stuff and I dont know what to do about it

Juan Carlos Mendoza
  • 5,736
  • 7
  • 25
  • 50
no name
  • 1
  • 3
  • 3
    Hint: Java is case sensitive – Ronald Sep 26 '17 at 20:40
  • Is it something with capital letters? I see that even on words like "reader" where there is a problem its marked red under it... – no name Sep 26 '17 at 20:45
  • Can I get a second hint? – no name Sep 26 '17 at 20:45
  • I think you also want to write the shorthand if statements differently. Instead of `if (score3 > 60); avg1 += 5;` go with `if (score3 > 60) avg1 += 5;`. The semicolon splits it into two different statements, effectively [causing the +5 logic to happen inevitably](https://stackoverflow.com/questions/14112515/semicolon-at-end-of-if-statement). – crenshaw-dev Sep 26 '17 at 20:46
  • 1
    If you fix the capital S on `Scanner`, then the red line under `reader` will probably disappear. `String` also has a capital S. – Dawood ibn Kareem Sep 26 '17 at 20:46
  • I did fix the capital S in scanner and string I managed to understand it lol, but it didnt fix it, I also noticed the capital s in the score that was a problem, so now my only problem is the variable reader – no name Sep 26 '17 at 20:52
  • I don't see in your code where you have declared your `reader` variable. Before using it you have to do something like this: `Scanner reader = new Scanner(System.in);` – Juan Carlos Mendoza Sep 26 '17 at 20:54
  • Oh, I did it and its ok now, thanks. – no name Sep 26 '17 at 20:57
  • We have never dont that in class btw, declaring "reader", it always works automatically there – no name Sep 26 '17 at 20:57
  • @noname No it doesn't. – Dawood ibn Kareem Sep 26 '17 at 20:58
  • @noname does your instructor provide some template to which you add your code? – crenshaw-dev Sep 26 '17 at 20:59
  • Yes, she gave that to us on the first lesson and from then we always just copy paste it to our next class, I guess its in there and I didnt even notice? @mac9416 – no name Sep 26 '17 at 21:03
  • @noname that would be my guess. What you're doing is probably the best way to learn what the template does: try doing without it, and fix whatever gets broken. – crenshaw-dev Sep 26 '17 at 21:05
  • @mac9416 honestly writing this stuff when you understand it is one of the funnest (hope thats a word) things lol – no name Sep 26 '17 at 21:09

1 Answers1

0

There is no stock "string" class, there is however a "String" class. Typical Java style is to have the first letter of a class capitalized.

Correctly specifying class names should resolve most of your issues.

Jason Mathison
  • 1,181
  • 1
  • 10
  • 18