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: - CD cd = (CD)supplies[currentIndex];
-
int confirm = JOptionPane.showConfirmDialog(this, "Are you sure you want to delete this item? "+cd.getItemNumber());
-
if(confirm == JOptionPane.YES_OPTION)
-
{
-
removeItemAt(currentIndex);
-
displayFirst();
-
}
-
}
-
-
}
-
-
}
-
private void modify()
-
{
-
CD cd = (CD)supplies[currentIndex];
-
panel = new JPanel();
-
JPanel add = new JPanel();
-
add.setLayout(new GridLayout(8, 3));
-
JButton update = makeButton("Update");
-
JLabel number = new JLabel("Number :");
-
JLabel name = new JLabel("Name :");
-
JLabel rating = new JLabel("Rating :");
-
JLabel quantity = new JLabel("Quantity :");
-
JLabel price = new JLabel("Price :");
-
add.add(number);
-
numberField.setText(""+cd.getItemNumber()); numberField.setEditable(false); add.add(numberField);
-
add.add(name);
-
nameField.setText(cd.getItemName()); add.add(nameField);
-
titleField.setText(cd.getTitle()); titleField.setEditable(false);
-
add.add(title); add.add(titleField);
-
add.add(quantity);
-
quantityField.setText(""+cd.getStockQuantity());
-
add.add(quantityField);
-
add.add(price);
-
add.add(priceField); priceField.setText(""+cd.getItemPrice());
-
panel.add(add);
-
JPanel forAddIt = new JPanel();
-
forAddIt.add(update);
-
panel.add(forAddIt);
-
displayHolder.remove(display);
-
displayHolder.add(panel);
-
//display = panel;
-
this.setVisible(true);
-
-
}
-
-
private void addItemToArray()
-
{
-
Product p = new CD(nameField.getText(), supplies.length + 1, Long.parseLong(quantityField.getText()),
-
Double.parseDouble(priceField.getText()), titleField.getText());
-
//Extend array by one
-
Product[] ps = new Product[supplies.length + 1];
-
for(int i = 0; i < ps.length-1; i++)
-
{
-
ps[i] = supplies[i];
-
}
-
ps[supplies.length] = p;
-
supplies = ps;
-
displayHolder.remove(panel);
-
displayHolder.add(display);
-
displayLast();
-
this.setVisible(false);
-
this.setVisible(true);
-
-
}
-
-
//Utility method
-
private void displayItemAt(int index)
-
{
-
-
CD product = (CDTitle)supplies[index];
-
itemName.setText("Item Name: "+ product.getItemName());
-
itemNumber.setText("Item Number: "+ product.getItemNumber());
-
rating.setText("Rating: "+ product.getRating());
-
quantity.setText("Quantity In Stock: "+ product.getStockQuantity());
-
price.setText("Item Price: "+ product.getItemPrice());
-
totalValue.setText("Total: " + product.calculateInventoryValue());
-
fee.setText("Fee :"+product.calculateRestockFee());
-
locked = false;
-
this.repaint();
-
-
-
this.setVisible(true);
-
}
-
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
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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;
};
};
|
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...
|
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
|
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
| |
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...
|
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...
|
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.
|
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?
|
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...
|
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...
| |
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,...
|
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,...
|
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...
|
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...
|
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...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |