-4

Every System.out.println I do fails with multiple errors. I am trying to have an input for 5 integers with "Please enter 5 integers" showing up.

here is what I have.

  import java.util.Scanner;

    public class SimpleMath {

        public static void main(String args[]) {

            Scanner user_input = new Scanner( System.in );
            System.out.println (“ Please enter 5 integers. ”);
            Int firstNumber = user_input.nextInt();
            Int secondNumber = user_input.nextInt();
            Int thirdNumber = user_input.nextInt();
            Int fourthNumber = user_input.nextInt();
            Int fifthNumber = user_input.nextInt();

Okay! I am using a mac cause i'm out of state, but here is an updated version of my code, i'm a brand new beginning coder, this literally took me 20 hours to do, and I have no idea why the quotes on this mac keyboard are curly I can't find the straight quotes.

So finally here is an update much better code source.

import java.util.Scanner;

public class SimpleMath {

    public static void main(String args[]) {

        Scanner user_input = new Scanner( System.in );
        int firstNumber = user_input.nextInt();
        int secondNumber = user_input.nextInt();
        int thirdNumber = user_input.nextInt();
        int fourthNumber = user_input.nextInt();
        int fifthNumber = user_input.nextInt();
        int sixthNumber;
        int seventhNumber;
        int eighthNumber;

        sixthNumber = firstNumber + secondNumber + thirdNumber + fourthNumber + fifthNumber;
        sixthNumber /= 5;
        System.out.println ( sixthNumber );
        // adding first second third fourth and fifth numbers then dividing by 5 to find the mean

        seventhNumber = firstNumber /= secondNumber;
        System.out.println ( seventhNumber );
        // first divided by second number with quotient

        eighthNumber = fourthNumber %= fifthNumber;
        System.out.println ( eighthNumber );
        // fourth divided by fifth number with remainder



    }
}
user2357112
  • 260,549
  • 28
  • 431
  • 505
Jay
  • 5
  • 1
  • 7
    Are you writing your code in Microsoft Word? What's up with the curly quotes? – user2357112 Dec 02 '14 at 01:25
  • Bad code formatting, and codes that are irrelevant to subject. So -1 – Adrian Shum Dec 02 '14 at 01:29
  • 2
    When you say "multiple errors", learning to read those errors is important, and posting them would also help others to help you. – Matt Coubrough Dec 02 '14 at 01:32
  • 2
    Looking at your other question, I see that you use TextEdit. You either need to use an editor that is better suited to programming, or at least turn off every single autocorrect feature in TextEdit. It's probably messing up your quote characters, and possibly capitalizing your `int`s, and who knows what else. – yellowantphil Dec 02 '14 at 01:46
  • When you say "fails" what you really mean is "does not compile". Please be accurate. – user207421 Dec 02 '14 at 02:23
  • 1
    The quotes on your keyboard are not curly. TextEdit is replacing your straight quotes with curly ones. If you can’t configure TextEdit to stop doing this, you need to find another editor to use. I am not familiar with Mac text editors, but someone on [Ask Different](http://apple.stackexchange.com/) could give you recommendations. Also, your question about `println` has been answered. If you have more questions, then you can ask them separately, rather than editing them into this same question. – yellowantphil Dec 02 '14 at 03:55

2 Answers2

4

You're using the wrong type of quote characters. String literals need to be quoted using regular/straight double quotes (") instead of curly/smart quotes ().

Also, Int should not be capitalized. It's either int (primitive) or Integer (wrapper type).

Robby Cornelissen
  • 91,784
  • 22
  • 134
  • 156
2

Your System.out.println() looks fine, but use straight quotes ("). But the i in int has to be lowercase, and there needs to be a closing bracket. Hope this works!

public static void main(String args[]) {

    Scanner user_input = new Scanner( System.in );
    System.out.println (“ Please enter 5 integers. ”);
    int firstNumber = user_input.nextInt();
    int secondNumber = user_input.nextInt();
    int thirdNumber = user_input.nextInt();
    int fourthNumber = user_input.nextInt();
    int fifthNumber = user_input.nextInt();

}
Aditya Ramkumar
  • 377
  • 1
  • 13