Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 19th, 2003, 02:37 PM
Registered User
 
Join Date: Sep 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cant seem to compile (small with source provided)

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 With Quote
  #2 (permalink)  
Old September 20th, 2003, 03:55 AM
Authorized User
 
Join Date: May 2003
Location: New Delhi, Delhi, India.
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Small Help From a Noob!!! maximus101 VB.NET 2002/2003 Basics 9 April 7th, 2006 10:30 PM
cannot check data provided by a form scifo Beginning PHP 1 August 6th, 2003 11:06 AM
problems to compile source tuebelhoer BOOK: Expert One-on-One J2EE Design and Development 0 June 24th, 2003 04:08 AM



All times are GMT -4. The time now is 10:14 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.