Problem getting program to run

Problem getting program to run

import java.util.*;
class KeyboardExample
{
public static void main(String args[])
{
int number1, number2, number3;
Scanner kbi = new Scanner(System.in);
System.out.println("Please type three integers");
number1 = kbi.nextInt();
number2 = kbi.nextInt();
number3 = kbi.nextInt();
System.out.printf("The average is
=%8.2f",(number1+number2+number3)/3.0);
}
}
waltbaby315Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

waltbaby315Author Commented:
I need someone to work me through the steps
0
mccarlIT Business Systems Analyst / Software DeveloperCommented:
It all seems fine to me other than making sure that ...

System.out.printf("The average is =%8.2f",(number1+number2+number3)/3.0);

is all on the one line. What is your exact problem? Are you getting any error messages, etc?
0
waltbaby315Author Commented:
This is the error I get
error4.JPG
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
Ok, as I said make sure that statement is all on one line!!!
0
waltbaby315Author Commented:
I put everything on one line an I still receive this error message


import java.util.*;
class KeyboardExample
{
public static void main(String args[])
{
int number1, number2, number3;
Scanner kbi = new Scanner(System.in);
System.out.println("Please type three integers");
number1 = kbi.nextInt();
number2 = kbi.nextInt();
number3 = kbi.nextInt();
System.out.printf("The average is =%8.2f",(number1+number2+number3)/3.0);
}
}
error5.JPG
0
mccarlIT Business Systems Analyst / Software DeveloperCommented:
That isn't a java problem at all. That is saying that the compile is trying to write the compiled output file to a file called "KeyboardExample.class" in the current directory but the operating system isn't allowing it. Do you have permissions to write files into your c:\ directory? Is there already a file called "KeyboardExample.class" that you don't have permissions to overwrite?

Try moving/copying your .java file to some other place where you know you have permission to write to (such as you My Documents folder or similar) and then compile from there.
0
waltbaby315Author Commented:
I move it to my documents  and I still get an error. How do I give myself permissions?
error6.JPG
0
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Set your path like you did in the other screenshot
0
waltbaby315Author Commented:
This is the error message I got
error7.JPG
0
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Why did you "cd\" back to the root directory????
What is the line under that trying to do?????


Go to the directory where your .java file is, with "cd \users\ivory family"

Set the path with "PATH=..."

Compile the program with "javac KeyboardExample.java"


Alternatively, think about downloading an IDE such as Netbeans or Eclipse. It may save you the trouble that you are having learning Windows commands, etc.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.