java-scuola/2.x/e2.14/RandomPrice.java

19 lines
364 B
Java
Raw Normal View History

2022-12-30 14:55:33 +01:00
import java.util.Random;
public class RandomPrice {
Random generator;
public RandomPrice() {
generator = new Random();
}
public String generaStr() {
int dollari = generator.nextInt(10) + 10;
int cent = generator.nextInt(95);
return dollari + "." + cent;
}
public double genera() {
return generator.nextDouble()*9.95 + 10;
}
}