• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I use or gain access to the easyScanner class in Jcreator?  RSS feed

 
Charles Sparking
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I use or gain access to the oblong class, bankAccount class and the easyScanner class in Jcreator?I am using Java in two semesters by charatan & Kans the second edition and am on chapter 6 classes and objects i cant seem to get any of these to compile...can anyone please help its really urgent?
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will probably find this thread moved elsewhere.
Please post the full text of the error messages. And there is no such thing as “urgent” here.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37510
554
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Charles,
Welcome to CodeRanch!

Those classes aren't built into Java. It sounds like they come from the book. And Campbell is right - you'll need to post some code and the error message to get help.
 
Charles Sparking
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.util.*;
public class oblongTester
{
public static void main(String[]args)
{
Scanner sc=new Scanner(System.in);
/*declare two variables to hold the length and height
*of the oblong as input by the uaer*/
double oblongLength, oblongHeight;

//declare a reference to an oblong object
Oblong myOblong;
//now get the values fromn the user
System.out.print("Please enter the length of your oblong");
oblongLength=sc.nextDouble();
System.out.print("Please enter the height of your oblong");
oblongHeight=sc.nextDouble();
//create a new oblong object
myOblong=new oblong(oblongLength,oblongHeight);
/*use the variousmethods of the oblong class to display
*the length, height, area and perimeter of the oblong*/
System.out.println("Oblong length is "+ myOblong.getLength());
System.out.println("oblong height is "+myOblong.getHeight());
System.out.println("oblong area is "+myOblong.calculateArea());
System.out.println("oblong perimeter is "
+myOblong.calculatePerimeter());

errors: cannot find symbol class oblong line 12
class oblong is public should be declared in a file named oblong.java line 1
cannot access oblong line 19
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The bit about class is public etc. should be self‑explanatory.
The bit about cannot find symbol oblong may mean that the word oblong is misspelt. It might need a capital O.
You will find a link about error messages on the mindprod site.
 
Charles Sparking
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
basically these classes are on a cd and i have to copy them to the correct directory for the compiler to access them but i have i dont kno what am doing wrong??
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is on the CD? Are they .java files or .class files? What sort of folder structure do you have on the CD? If they are .java files, do they have package names? Hint: The package name has to be the first non‑comment line in the file.
 
Charles Sparking
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes they are java source files

the structure is as follows
 
Charles Sparking
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to use some indentation to make it clearer but i guess it doesnt show that. but anyways java sourcefiles inside that are folders Chapter05-Chapter24. Chapter06 has 3 files on it Oblong, easyScanner and bankaccount. These are the classes that am trying to get to compile.
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added code tags and the indentation reappeared. You could try   several times, as an alternative.
Do your source files have package names in?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!