I have problem.
- I create a list of the specified range of the keyboard.
- I create the map, which is a list of the key, and the values are the result of the equation.
Here is my code:
static Map<Double, Double> podajDane(int lewy, int prawy) {
//y=2x+3
List<Double> listaX = new ArrayList();
for (int i = lewy; i <= prawy; i++) {
listaX.add((double) i);
}
Map<Double, Double> wynik = new HashMap<Double, Double>();
for (Double liczba : listaX) {
double y = 2 * liczba + 3; <---
wynik.put(liczba, y);
}
return wynik;
}
I need to replace the line of code to the equation taken from the TextField entered by the user
TextField field = new TextField();
When the user enters the equation x + 2 should be downloaded from the list of value, which is the key maps.
How can i do this?