Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Курсовая работа / InternetConnection / src / ic / core / SalesCompany
.java /*
* SalesCompany.java
*
* Created on April 20, 2007, 1:38 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package ic.core;
import java.util.*;
import java.lang.*;
/**
*
* @author adm
*/
public class SalesCompany {
String name = new String("");
HashMap priceList = new HashMap();
public HashMap getPrice() {
return priceList;
}
public SalesCompany() {
this.name = "Company Name Inc.";
}
public SalesCompany(String name) {
this.name = name;
}
public void addPriceValue(String good, float price) {
priceList.put(good,price);
}
public float getPriceByName(String good) {
Float f;
f=(Float)priceList.get(good);
return f.floatValue();
}
public HashMap getGoodsByPrice(float minPrice, float maxPrice) {
HashMap h = new HashMap();
Iterator iter = priceList.keySet().iterator();
for(int i=0; i<priceList.keySet().size(); i++) {
Object name = iter.next();
Float f = (Float)priceList.get(name);
if(f.floatValue() >minPrice && f.floatValue() < maxPrice) {
h.put(name.toString(), f.floatValue());
}
}
return h;
}
public String getName() {
return name;
}
}
* SalesCompany.java
*
* Created on April 20, 2007, 1:38 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package ic.core;
import java.util.*;
import java.lang.*;
/**
*
* @author adm
*/
public class SalesCompany {
String name = new String("");
HashMap priceList = new HashMap();
public HashMap getPrice() {
return priceList;
}
public SalesCompany() {
this.name = "Company Name Inc.";
}
public SalesCompany(String name) {
this.name = name;
}
public void addPriceValue(String good, float price) {
priceList.put(good,price);
}
public float getPriceByName(String good) {
Float f;
f=(Float)priceList.get(good);
return f.floatValue();
}
public HashMap getGoodsByPrice(float minPrice, float maxPrice) {
HashMap h = new HashMap();
Iterator iter = priceList.keySet().iterator();
for(int i=0; i<priceList.keySet().size(); i++) {
Object name = iter.next();
Float f = (Float)priceList.get(name);
if(f.floatValue() >minPrice && f.floatValue() < maxPrice) {
h.put(name.toString(), f.floatValue());
}
}
return h;
}
public String getName() {
return name;
}
}
Соседние файлы в папке core