473,396 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

adding to a cart error

oll3i
679 512MB
Expand|Select|Wrap|Line Numbers
  1. public class KwiaciarniaMVC {
  2.  
  3.     public static void main(String[] args) {
  4.  
  5.         KwiaciarniaModel     model      = new KwiaciarniaModel();
  6.         KwiaciarniaView       view       = new KwiaciarniaView(model);
  7.         KwiaciarniaController controller = new KwiaciarniaController(model, view);
  8.  
  9.         view.setVisible(true);
  10.  
  11.         Kwiaciarnia kwiaciarnia = new Kwiaciarnia();
  12.         Wozek wozek = new Wozek();
  13.     }
  14. }
  15.  

then in other class

Expand|Select|Wrap|Line Numbers
  1. if("Roza Czerwona".equals(wybrany_kwiat)){
  2.  
  3.         wozek.dodajDoWozka(new RozaCzerwona(),a);
  4.  
  5.         }
  6.  
why eclipse says that wozek cannot be resolved
wozek means shoppingcart
Apr 4 '07 #1
1 1013
JosAH
11,448 Expert 8TB
Expand|Select|Wrap|Line Numbers
  1. public class KwiaciarniaMVC {
  2.  
  3.     public static void main(String[] args) {
  4.  
  5.         KwiaciarniaModel     model      = new KwiaciarniaModel();
  6.         KwiaciarniaView       view       = new KwiaciarniaView(model);
  7.         KwiaciarniaController controller = new KwiaciarniaController(model, view);
  8.  
  9.         view.setVisible(true);
  10.  
  11.         Kwiaciarnia kwiaciarnia = new Kwiaciarnia();
  12.         Wozek wozek = new Wozek();
  13.     }
  14. }
  15.  
then in other class

Expand|Select|Wrap|Line Numbers
  1. if("Roza Czerwona".equals(wybrany_kwiat)){
  2.  
  3.         wozek.dodajDoWozka(new RozaCzerwona(),a);
  4.  
  5.         }
  6.  
why eclipse says that wozek cannot be resolved
wozek means shoppingcart
The only Wozek I can see from your code is a variable 'wozek' defined in your
main method and so it is a local variable. It certainly isn't visible outside of that
main method and most certainly not in an entirely different class.

Shouldn't you pass that Wozek to the other class object so it can use it?

kind regards,

Jos
Apr 4 '07 #2

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

Similar topics

6
by: Fnark! | last post by:
I am creating a shopping cart using PHP Version 4.1.2. I am creating and registering a cart object in a session. The cart object contains an array of arrays called $order whose elements are a...
20
by: David | last post by:
I have a one-line script to add an onunload event handler to the body of the document. The script is as follows: document.getElementsByTagName("BODY").onunload=function s() {alert("s")} Now...
0
by: psb | last post by:
imagine a shopping cart application. I am on the product details page. this page has a cart summary on the right hand side of the page. the cart summary is a webcontrol that sits in the aspx page...
7
by: isaac2004 | last post by:
hi i have a basic asp page that acts as an online bookstore. on my cart page i am having trouble generating 3 numbers; a subtotal, a shipping total, and a final price. here is my code i would...
0
by: Laura K | last post by:
I am working with a shopping cart (I am suing a book). At this point I am trying to add the cartID, the productID, quantity and time. At the same time it is supposed to add a cookie. When I...
2
by: Azzuron | last post by:
We are trying to translate some raw flat data into a cart. What we have done is BCP the raw files into the database, and then we begin to run a series of SQL commands to copy the data and format it...
1
by: someguy | last post by:
I am developing a shopping cart and I have the following question. People can add products to their shopping cart whether they are logged in or not, however their items go to what I call a ...
3
by: someguy | last post by:
I am developing a shopping cart and have come across a problem. I have developed it in such a way that there is two carts, I call them the user_cart and the session_cart,, but they all really go to...
4
ak1dnar
by: ak1dnar | last post by:
Hi, I am Building small shopping cart that enables customers to select books from the list and Add it to the Cart. When i click Add Button the Cart Should Update with these things. No of...
1
by: jecha | last post by:
I'm implementing a shopping cart but am having a problem in checking out a person who has added item in his/her shopping busket.The code for the checkout.php script is given below <?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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,...

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.