473,770 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cannot invoke setCennik(Strin g,double)

oll3i
679 Contributor
Expand|Select|Wrap|Line Numbers
  1. public class Cennik {
  2.      private static Cennik instance = null;
  3.      Map<String,Double> cennik = new HashMap<String,Double> ();
  4.  
  5.        private Cennik() {  // prywatny konstruktor
  6.        }
  7.  
  8.        public static Cennik getInstance() {
  9.           if(instance == null) {
  10.              instance = new Cennik();
  11.  
  12.           }
  13.           return instance;
  14.        }
  15.  
  16. public void setCennik(String nazwaKwiat,double cena){       
  17.     cennik.put(nazwaKwiat,cena);   
  18. }
  19.  
  20. public  Map<String,Double> getCennik(){ return cennik;}
  21. }
  22.  
  23.  
  24.  
  25.  
  26. public class Kwiaciarnia {
  27.   Cennik c= Cennik.getInstance();
  28.  
  29.   public Kwiaciarnia(){
  30.   c.setCennik("Roza Czerwona",5.0);
  31.   c.setCennik("Roza Biala",5.0);
  32.   c.setCennik("Roza Zolta",5.0);
  33.   c.setCennik("Roza Czarna",10.0);
  34.   c.setCennik("Tulipan Zolty",3.50);
  35.   c.setCennik("Tulipan Czerwony",3.50);
  36.   c.setCennik("Tulipan Bialy",3.50);
  37.   c.setCennik("Lilia Biala",7.50);
  38.   c.setCennik("Lilia Zolta",7.50);
  39.   c.setCennik("Lilia Rozowa",7.50);
  40.   }
  41.  
  42. private static void dodajKwiat(String n,double c){
  43.  
  44.     c.setCennik(n,c);
  45.  
  46.     }  
  47. }
  48.  

eclipse says that i have an error in c.setCennik(n,c ); it says cannot invoke setCennik(Strin g,double) on the primitive type double
why? and what shd i change in the code?
Mar 30 '07 #1
5 2331
JosAH
11,448 Recognized Expert MVP
Did you tell Eclipse to use the version 5 or version 6 compliant compiler?

You can find it at Project>Propert ies>Java Compiler

kind regards,

Jos
Mar 30 '07 #2
oll3i
679 Contributor
i set it to 5
Mar 30 '07 #3
oll3i
679 Contributor
they want us to use 5.0
Mar 30 '07 #4
oll3i
679 Contributor
but switching between 6 and 5 doesnt change a thing
Mar 30 '07 #5
sicarie
4,677 Recognized Expert Moderator Specialist
Ok, I'm still on quite a bit of NyQuil, so I'm probably missing something here, but I'm just going to ask where are String nazwaKwiat, and double cena declared in the class?

Also, you're declaring this as a Singleton. One instance. Yet you want to set it with six or seven different values? Might you want a CennikList() Singleton class more than a Cennik() Singleton class?
Mar 30 '07 #6

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

Similar topics

1
3616
by: Gregory Hassett | last post by:
Hi, I have a web service called GetComputerNameAndDescription which I can call from the main thread of my app. If I call it from a separate thread, however, it hangs on the call to Invoke() -- but only if I'm in the debugger. Here's a stack trace with non-user code shown -- the call to RegisterNotifySource, at the top of the stack, never returns -- I have to do a "break all" inside the debugger, then find this thread and examine its call...
0
2961
by: Pawan Narula via DotNetMonster.com | last post by:
hi all, i'm using VB.NET and trying to code for contact management in a tree. all my contacts r saved in a text file and my C dll reads them one by one and sends to VB callback in a sync mode thread. so far so good. all contacts r added properly. now when another login adds me in his contact, i recv a subscription, so i popup a form and ask for accept/reject. this all happens in a separate thread. popup form gets opened and choice is...
1
18203
by: Marc | last post by:
Hi! I'm working with a C# client that calls a php web service. I've created a wrapper to call the service using .NET wsdl tool (adding a web reference). The call to the server works fine, it is serialized correctly, and the server returns a response (I've captured the response and it's correct!) but when the .NET deserialize this response, it throws the exception "System.InvalidOperationException: There is an error in XML
18
2913
by: Paul Roberts | last post by:
Hiya I have a string with about 300+ characters, how can i insert a line break or another character every 50 characters for the whole string? Paul Roberts
0
1361
by: Sreedhar | last post by:
Hi, I am working on the Application which will use wse2.0 to get the data from the server and when I hosted in sharepoint which has wse3.0, I am getting the following error after some period of time. Unknown exception System.Web.Services.Protocols.SoapHeaderException: Microsoft.Web.Services2.Security.SecurityFault: The specified source for the derivation is unknown ---> System.Exception: WSE512: This derived key token's
2
13593
by: John Smith | last post by:
I'm writing webervice client using .Net 2.0. I have this class: public class MyWebService : SoapHttpClientProtocol { public XmlDocument validate(string url, XmlDocument xmlDocument) { this.Url = url;
4
3883
by: John Smith | last post by:
How can I allow someone to cast my C# class into System.String? Is it possible in C#? In C++ I used "operator" keyword to mark C++ member function.
0
1129
by: Dan | last post by:
Hi I have a dotnet application that communicates with a web service running locally on my machine. It connects fine and works ok when I run the application from the c: drive. Am having problems running it from my ftp location, so ftp://localhost/setup.exe In the Runtime security policy I have created a new code group under my
3
5270
by: =?Utf-8?B?Sm9l?= | last post by:
I know that I have posted this question before, but it is still unresolved and I don't know where to turn to next. I have code that is creating a user (works fine), then sets the account flags (works fine) and then sets the password (fails). Here is the pertinent information: Ex.InnerException.Message: Logon failure: unknown user name or bad password. Ex.Message: Exception has been thrown by the target of an invocation.
0
9618
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
10260
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8933
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
7456
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
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
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...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.