-
public class Cennik {
-
private static Cennik instance = null;
-
Map<String,Double> cennik = new HashMap<String,Double> ();
-
-
private Cennik() { // prywatny konstruktor
-
}
-
-
public static Cennik getInstance() {
-
if(instance == null) {
-
instance = new Cennik();
-
-
}
-
return instance;
-
}
-
-
public void setCennik(String nazwaKwiat,double cena){
-
cennik.put(nazwaKwiat,cena);
-
}
-
-
public Map<String,Double> getCennik(){ return cennik;}
-
}
-
-
-
-
-
public class Kwiaciarnia {
-
Cennik c= Cennik.getInstance();
-
-
public Kwiaciarnia(){
-
c.setCennik("Roza Czerwona",5.0);
-
c.setCennik("Roza Biala",5.0);
-
c.setCennik("Roza Zolta",5.0);
-
c.setCennik("Roza Czarna",10.0);
-
c.setCennik("Tulipan Zolty",3.50);
-
c.setCennik("Tulipan Czerwony",3.50);
-
c.setCennik("Tulipan Bialy",3.50);
-
c.setCennik("Lilia Biala",7.50);
-
c.setCennik("Lilia Zolta",7.50);
-
c.setCennik("Lilia Rozowa",7.50);
-
}
-
-
private static void dodajKwiat(String n,double c){
-
-
c.setCennik(n,c);
-
-
}
-
}
-
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?
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
but switching between 6 and 5 doesnt change a thing
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?
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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
|
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
|
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
| |
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;
|
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.
|
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
|
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.
|
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: 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...
| |
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: 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();...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |