473,656 Members | 2,777 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with error messages..

6 New Member
Hello- I cant seem to figure out why I am getting the following error:

cannot find symbol : class CD
location: class Inventory5
CD cd = (CD)supplies[currentIndex];
^

I'm getting this on several lines, and something tells me it is a silly error, but I can't find it. Here is the part of the code where I get the errors:

Expand|Select|Wrap|Line Numbers
  1. CD cd = (CD)supplies[currentIndex];
  2.      int confirm = JOptionPane.showConfirmDialog(this, "Are you sure you want to delete this item? "+cd.getItemNumber());
  3.          if(confirm == JOptionPane.YES_OPTION)
  4.          {
  5.      removeItemAt(currentIndex);
  6.      displayFirst();
  7.      }
  8. }
  9.  
  10. }
  11.  
  12. }
  13. private void modify()
  14. {
  15. CD cd = (CD)supplies[currentIndex];
  16. panel = new JPanel();
  17. JPanel add = new JPanel();
  18. add.setLayout(new GridLayout(8, 3));
  19. JButton update = makeButton("Update");
  20. JLabel number = new JLabel("Number :");
  21. JLabel name = new JLabel("Name :");
  22. JLabel rating = new JLabel("Rating    :");
  23. JLabel quantity = new JLabel("Quantity :");
  24. JLabel price = new JLabel("Price    :");
  25. add.add(number);
  26. numberField.setText(""+cd.getItemNumber()); numberField.setEditable(false); add.add(numberField);
  27. add.add(name);
  28. nameField.setText(cd.getItemName()); add.add(nameField);
  29. titleField.setText(cd.getTitle()); titleField.setEditable(false);
  30. add.add(title); add.add(titleField);
  31. add.add(quantity);
  32. quantityField.setText(""+cd.getStockQuantity());
  33. add.add(quantityField);
  34. add.add(price);
  35. add.add(priceField); priceField.setText(""+cd.getItemPrice());
  36. panel.add(add);
  37. JPanel forAddIt = new JPanel();
  38. forAddIt.add(update);
  39. panel.add(forAddIt);
  40. displayHolder.remove(display);
  41. displayHolder.add(panel);
  42. //display = panel;
  43.      this.setVisible(true);
  44.  
  45. }
  46.  
  47. private void addItemToArray()
  48. {
  49. Product p = new CD(nameField.getText(), supplies.length + 1, Long.parseLong(quantityField.getText()),
  50. Double.parseDouble(priceField.getText()), titleField.getText());
  51. //Extend array by one
  52. Product[] ps = new Product[supplies.length + 1];
  53. for(int i = 0; i < ps.length-1; i++)
  54. {
  55. ps[i] = supplies[i];
  56. }
  57. ps[supplies.length] = p;
  58. supplies = ps;
  59. displayHolder.remove(panel);
  60. displayHolder.add(display);
  61. displayLast();
  62. this.setVisible(false);
  63. this.setVisible(true);
  64.  
  65. }
  66.  
  67. //Utility method
  68. private void displayItemAt(int index)
  69. {
  70.  
  71. CD product = (CDTitle)supplies[index];
  72. itemName.setText("Item Name: "+ product.getItemName());
  73. itemNumber.setText("Item Number: "+ product.getItemNumber());
  74. rating.setText("Rating: "+ product.getRating());
  75. quantity.setText("Quantity In Stock: "+ product.getStockQuantity());
  76. price.setText("Item Price: "+ product.getItemPrice());
  77. totalValue.setText("Total: " + product.calculateInventoryValue());
  78. fee.setText("Fee :"+product.calculateRestockFee());
  79. locked = false;
  80. this.repaint();
  81.  
  82.  
  83. this.setVisible(true);
  84. }
  85.  
May 25 '07 #1
1 1093
JosAH
11,448 Recognized Expert MVP
Obviously the compiler can't find the class CD anywhere. Did you compile your
CD class? Did you tell the compiler where to find that class? Did you set the
'classpath' command line option for your compiler?

kind regards,

Jos
May 26 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3046
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers to have an easier time understanding what I do. Therefore this weekend I'm going to spend 3 days just writing comments. Before I do it, I thought I'd ask other programmers what information they find useful. Below is a typical class I've...
0
2448
by: |-|erc | last post by:
<?php // Get the names and values for vars sent by index.lib.php3 if (isset($HTTP_GET_VARS)) { while(list($name,$value) = each($HTTP_GET_VARS)) { $$name = $value; }; };
2
1905
by: lkrubner | last post by:
This is a general computer question, but I'm writing in PHP so I'll post this to comp.lang.php. I've been writing a content management system. I've a Singleton object that keeps track of all errors and stores them in an array. As things work right now, I write out each error message individually. I'm thinking that as the code grows, this system will not continue to scale. Right now my software consists of 1.4 megs of PHP code. I don't...
2
2173
by: OZ | last post by:
Hi, I am new C++ and need a little help with a public domain program that is suppose to perform a byte swap. I am receiving the following error messages during the compile process with Microsoft C++ 2003. Here are the error messages and source code: (97) : error C2664: 'fgetpos' : cannot convert parameter 2 from 'void
8
2000
by: Bshealey786 | last post by:
Okay im doing my final project for my first computer science class(its my major, so it will be my first of many), but anyway im a beginner so im not to great with C++ yet. Anyway this is the error msg that im getting: "Error executing cl.exe" this is the code that I have, but I know whats causing it, ill just show you the whole thing first though //file: Quadratic
2
1987
by: CSDunn | last post by:
Hello, I need some assistance with error handling in an Access 2003 Project form. The project is has a data source connection to a SQL Server 2000 database. The main form is named ‘frmSelectByTest', and its subform's ‘Name' and ‘Source Object' properties are ‘frmSelectByTestSub'. The ‘Default View' on the main form is ‘Single Form', and on the sub form is ‘Continuous Forms'. The users select the name of a test (uniquely identified by a...
7
2356
by: Jack Addington | last post by:
I've got a fairly simple application implementation that over time is going to get a lot bigger. I'm really trying to implement it in a way that will facilitate the growth. I am first writing a WinForms interface and then need to port that to a web app. I am kinda stuck on a design issue and need some suggestions / direction. Basically I have a business layer that I want to use to process any dataentry logic (row focus changes, data...
11
2013
by: GHUM | last post by:
Hello, I created some rather complex Intranet Application, using lots of JavaScript, DOM-Maninpulation and XMLHTTPRequest communication. I developed on FireFox, with the excellent firebug ... every misstake was given back with a fine, fine traceback; exactly pointing to the code at error. My code runs fine on FireFox and Opera.
34
2726
by: Umesh | last post by:
I want to extract a string abc*xyz from a text file. * indicates arbitrary no. of characters. I'm only able to do it when the string has definite no. of characters or the string length is constant: i.e. five or the string is abc????? xyz How can i generalize it for any length of the string?
0
1084
kiseitai2
by: kiseitai2 | last post by:
Hello everyone. I'm making a chatting program to share with my friends and to prove to a friend it can be done on visual basic. Unfortunately, I want the application to upload the text files generated in the chatting process but I can't upload them to my website since (while debugging) it tells me that I must include a file name in the uploading path. Example, (this one is how I want it to be) the text file is C:\text.txt and I want to upload it...
0
8382
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8498
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8600
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7311
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1930
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1600
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.