What in the world am I doing wrong? Can someone please help me. I am especially lost on the last method.

I am supposed to use two classes to perform one of three math operations depending on the user's choice. Use if statements to allow the user to choose which math operation to execute.

So I created two files one file called Math and the other MathStart. Please see below.
Must ‘if’ statements have an else? I think what is suppose to happen is, I prompt the user to see with choice they want to use and then whichever they choose that program is run.

Here are the errors that I am getting for this program:

C:\Documents and Settings\Triffee\My Documents\Math316.java:83: ')' expected
System.out.println("You entered: "count + ", " + ++count + ", " + ++count + ", " + ++count+ ", and" + ++count);
^
C:\Documents and Settings\Triffee\My Documents\Math316.java:83: not a statement
System.out.println("You entered: "count + ", " + ++count + ", " + ++count + ", " + ++count+ ", and" + ++count);
^
C:\Documents and Settings\Triffee\My Documents\Math316.java:83: ';' expected



import java.util.*;


public class Math316
{


private static Scanner keyboard = new Scanner(System.in);    //sets up things so program can have keyboard input


public static void ProductOfTwoDoubles()
{


double d1, d2, answer;           // declares variable type


System.out.println("Please enter any two numbers separated by a space.");    //user prompts
System.out.print("This program will multiply the numbers for you.");


d1 = keyboard.nextDouble();                  //reads one double from the keyboard
d2 = keyboard.nextDouble();


answer = d1 * d2;


System.out.println("You entered " + d1 + " and " + d2);
System.out.println("\n");
System.out.println("The product is: "+ answer + ".\n");


}                                     //end ProductOfTwoDoubles method


public static void ThreeIntegers();


private static Scanner keyboard = new Scanner(System.in);    //sets up things so program can have keyboard input


{
int n1, n2, n3, sum;           // declares variable type



System.out.println("Please enter 3 whole numbers separated by one or more spaces.");    //user prompts
System.out.print("This program will add the numbers for you.");


n1 = keyboard.nextInt();                  //reads one int from the keyboard
n2 = keyboard.nextInt();
n3 = keyboard.nextInt();


sum = n1 + n2 + n3;


System.out.println("You entered " + n1 + n2);
System.out.println(" and " + n3);
System.out.println("The sum is: "+ sum + ".\n");


}                           //end ThreeIntegers  method



public static void CountPlusFive();


private static Scanner keyboard = new Scanner(System.in);    //sets up things so program can have keyboard input


{


int count;



System.out.println("Please enter one whole numbers.");    //user prompts
System.out.print("This program will display that number and the next five integers in sequence.");


System.out.println(count + ", " + ++count + ", " + ++count + ", " + ++count+ ", " + ++count+ ", " + ++count);


count = keyboard.nextInt();                  //reads one int from the keyboard


System.out.println("You entered: "count + ", " + ++count + ", " + ++count + ", " + ++count+ ", and" + ++count);
System.out.println("\n");


}                           //end CountPlusFive  method


}                           // brace - end Math316 Class



************************************************************************Next file is below:--it has lots of errors 



C:\Documents and Settings\Triffee\My Documents\MathStart316.java:33: cannot find symbol
symbol  : class Scanner
location: class MathStart316
Scanner keyboard = new Scanner(System.in);
^
C:\Documents and Settings\Triffee\My Documents\MathStart316.java:33: cannot find symbol
symbol  : class Scanner
location: class MathStart316
Scanner keyboard = new Scanner(System.in);
^
C:\Documents and Settings\Triffee\My Documents\MathStart316.java:35: cannot find symbol
symbol  : variable scannerObject
location: class MathStart316
choice1 = scannerObject.nextInt();  //reads one int form the keyboard
^
C:\Documents and Settings\Triffee\My Documents\MathStart316.java:36: cannot find symbol
symbol  : variable scannerObject
location: class MathStart316
choice2 = scannerObject.nextInt();
^
C:\Documents and Settings\Triffee\My Documents\MathStart316.java:37: cannot find symbol
symbol  : variable scannerObject
location: class MathStart316
choice3 = scannerObject.nextInt();
^
C:\Documents and Settings\Triffee\My Documents\MathStart316.java:39: cannot find symbol
symbol  : variable choice
location: class MathStart316
if (choice==1)
^
.\Math316.java:83: ')' expected
System.out.println("You entered: "count + ", " + ++count + ", " + ++count + ", " + ++count+ ", and" + ++count);
^
.\Math316.java:83: not a statement
System.out.println("You entered: "count + ", " + ++count + ", " + ++count + ", " + ++count+ ", and" + ++count);
^
.\Math316.java:83: ';' expected
System.out.println("You entered: "count + ", " + ++count + ", " + ++count + ", " + ++count+ ", and" + ++count);
^
.\Math316.java:44: keyboard is already defined in Math316
private static Scanner keyboard = new Scanner(System.in);    //sets up things so program can have keyboard input
^
.\Math316.java:69: keyboard is already defined in Math316
private static Scanner keyboard = new Scanner(System.in);    //sets up things so program can have keyboard input
^
C:\Documents and Settings\Triffee\My Documents\MathStart316.java:42: cannot find symbol
symbol  : variable choice
location: class MathStart316
if (choice==2)
^
C:\Documents and Settings\Triffee\My Documents\MathStart316.java:45: cannot find symbol
symbol  : variable choice
location: class MathStart316
if (choice==3)
^
.\Math316.java:42: missing method body, or declare abstract
public static void ThreeIntegers();
^
.\Math316.java:67: missing method body, or declare abstract
public static void CountPlusFive();
^
15 errors


Tool completed with exit code 1


* This program menu will allow you to multiply, add, and count.
Please choose from the one of the following by entering the
number of your choice from the list below:



1: Multiply two doubles
2: Add three integers
3: Count five numbers past your number


*********************************************************/


public class MathStart316


{                                             /* brace - start of class MathStart316/
/* public static makes the main method available to any user*/
public static void main(String[] args)


{


int choice1, choice2, choice3;


System.out.println("Please enter the number of your choice:");


Scanner keyboard = new Scanner(System.in);


choice1 = scannerObject.nextInt();  //reads one int form the keyboard
choice2 = scannerObject.nextInt();
choice3 = scannerObject.nextInt();


if (choice==1)
Math316.ProductOfTwoDoubles();


if (choice==2)
Math316.ThreeIntegers();


if (choice==3)
Math316.CountPlusFive();


}


}

learning ho the compiler interprets things might help. Your "+ ++count" for example gets interpreted by the compiler as +++count, which isn't going to make much sense to it.

And learning Java might also help. Where are your import statements? Remember that Java is case sensitive. Remember you have to declare variables before using them.
Learn to interpret compiler errors (as well as runtime errors). Life's a lot easier that way.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.