Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Object Oriented program question

Reply
Thread Tools

Object Oriented program question

 
 
jon3484
Guest
Posts: n/a
 
      07-19-2005
It's my first time running an object oriented program (Circleprogram.java
and Circle.class), and I have a few questions.

Do you have to compile the actual java program (in my case
Circleprogram.java)? I actually tried to compile the program, but still
got the error "error: cannot read:Circleprogram.java". I had someone
proof read my coding, and he spotted some errors, but I corrected them,
and still having problem.



 
Reply With Quote
 
 
 
 
Wayne
Guest
Posts: n/a
 
      07-19-2005
jon3484 wrote:
> It's my first time running an object oriented program (Circleprogram.java
> and Circle.class), and I have a few questions.
>
> Do you have to compile the actual java program (in my case
> Circleprogram.java)? I actually tried to compile the program, but still
> got the error "error: cannot read:Circleprogram.java". I had someone
> proof read my coding, and he spotted some errors, but I corrected them,
> and still having problem.
>
>
>

At the command line prompt you must make sure the current directory
is where the program is. The prompt usually tells you where you
are. If your program is in "My Documents" and your prompt is
"C:\>" Then you get this error. You can change the current
directory with the "cd" command.

You can also get this error if you make a typo in the program
name. You can type "dir" to see the names. In your
case you should see "Circleprogram.java", and not
"CircleProgram.java" or "Circleprogram.java.txt"

It is likely that the classname is really "CircleProgram". Note
the capital letters!

Hope this helps!

-Wayne
 
Reply With Quote
 
 
 
 
jon3484
Guest
Posts: n/a
 
      07-19-2005
Thanks, I finally got it compiled, however now I'm getting errors about no
definition class. I'm getting the same message for both my class file and
the actual program.

import javax.swing.JOptionPane;

public class Circleprogram
{
public static void main (String[]args)
{
double number, area, circumference, diameter, radius;
String input;

Circle info = new Circle();

input= JOptionPane.showInputDialog("What is the radius");

number = Double.parseDouble(input);
info.setRadius(number);

radius= info.getRadius();
area = info.getArea();
diameter = info.getDiameter();
circumference = info.getCircumference();

JOptionPane.showMessageDialog(null, "The area is" + area +
", the circumference is" + circumference +
", the diameter" + diameter + ", and the radius is " +
radius);

System.exit(0);
}
}

this is the actual program

 
Reply With Quote
 
hilz
Guest
Posts: n/a
 
      07-19-2005
jon3484 wrote:
> Thanks, I finally got it compiled, however now I'm getting errors about no
> definition class. I'm getting the same message for both my class file and
> the actual program.



http://www.mindprod.com/jgloss/runer...SDEFFOUNDERROR

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
object oriented design question in context of Java program J W Java 2 06-21-2012 06:33 PM
class-oriented rather than object-oriented? notnorwegian@yahoo.se Python 2 05-26-2008 04:42 PM
How to write object oriented program in c SSG C Programming 18 08-11-2005 10:25 PM
Object oriented drawing program Abs Java 1 05-11-2004 11:04 AM
Object oriented does not mean class oriented rolo Ruby 3 04-09-2004 02:51 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57