Ok, I made some changes. I am down to 1 complilation error and I can't figure out what to do.

Here is the error message:

C:\Documents and Settings\Triffee\My Documents\Math316.java:87: reached end of file while parsing
} //end CountPlusFive method
^
1 error

Tool completed with exit code 1


I have also attached the MathStart316 class below this one. Am I way off?

/* This program has two classes: Math316.java & MathStart316.java.
MathStart316.java contains the main method and also the 'if' statements
whereas Math316.java has three methods. The methods are: ProductOfTwoDoubles,
ThreeIntegers and CountPlusFive. */

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();
{

/*brace - start of friendName method*/

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();


{ /*brace - start of friendName method*/

int count=0;
char s= count + ", " + ++count + ", " + ++count + ", " + ++count+ ", " + ++count+ ", " + ++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("You entered " + s);


for (int i=0;i<=5;i++)
{
if (name.charAt(i)!=s.charAt(i)) {
count++;
}

System.out.println("\n");

} //end CountPlusFive method

// brace - end Math316 Class

__________________________________________________ ______________
__________________________________________________ ______________


* 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 math316(String[] args)

{

int choice1, choice2, choice3;


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



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

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

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

}

}

Recommended Answers

All 5 Replies

You are probably missing an ending brace }. Try to pair the braces properly and you would be good to go.

And by the way, learn to format your code so that simple mistakes like these never occur or get a better text editor in case your current one doesn't support syntax highlighting.

Where do I find or how would I use code tags?

I figured that it is a brace that I am missing, but when add I still get the error and when I take away a brace that I think might be an extra brace, I get like 10 or more errors added.

By the way, do you know if my program is correct otherwise?

Your program is thoroughly broken due to improper commenting. Instead of typing the entire 100 line program, write it in chunks and keep compiling at regular intervals. It would save you a lot of hassle. It's no fun debugging / removing compiler errors from a behemoth code snippet.

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.