|
Subject:
|
Cant seem to compile (small with source provided)
|
|
Posted By:
|
noob1
|
Post Date:
|
9/19/2003 2:37:03 PM
|
This is the source code.
SOURCE: /** A Compact Disk has a title and a cost. */ public class CompactDisk { /** Constructs a default compact disk with blank title "title" and price of 0 dollars. */ public CompactDisk() { price = 0; title = "title"; } /** Constructs a compact disk with a given name and price. @param initialPrice the price of the compact disk. @param aName the title of the compact disk. */ public CompactDisk(String aName,double initialPrice) { title = aName; price = initialPrice; } /** Sets the title of the Compact Disk to a new title. @param newName the new title of the Compact Disk. */ public void setTitle(String newName) { title = newName; } /** Gets the current title of the Compact Disk. @return the title of the Compact Disk. */ public String getName() { return name; } /** Gets the price of a compact disk. @return the price of the Compact Disk. */ public double getPrice() { return price; } }
ok these are the compiler errors COMPILER ERROR:
----jGRASP exec: javac C:\WINDOWS\Desktop\CompactDisk.java CompactDisk.java:21: cannot resolve symbol symbol : variable price location: class CompactDisk price = 0; ^ CompactDisk.java:22: cannot resolve symbol symbol : variable title location: class CompactDisk title = "title"; ^ CompactDisk.java:32: cannot resolve symbol symbol : variable title location: class CompactDisk title = aName; ^ CompactDisk.java:33: cannot resolve symbol symbol : variable price location: class CompactDisk price = initialPrice; ^ CompactDisk.java:43: cannot resolve symbol symbol : variable title location: class CompactDisk title = newName; ^ CompactDisk.java:52: cannot resolve symbol symbol : variable name location: class CompactDisk return name; ^ CompactDisk.java:61: cannot resolve symbol symbol : variable price location: class CompactDisk return price; ^ 7 errors ----jGRASP wedge2: exit code for process is 1. ----jGRASP: operation complete.
|
|
Reply By:
|
Yashraj Chauhan
|
Reply Date:
|
9/20/2003 3:55:51 AM
|
Hi
You need to specify the variable type for price and name say for example
int price or float price etc. and you your name variable should be of type String.
Regards
Yashraj Chauhan Java\J2EE Specialist Wiley Support Team
|