public class Main {
public static void main(String[] args) {
GroceryStore houstonStore = new GroceryStore();
GroceryStore orlandoStore = new GroceryStore();
GroceryStore seattleStore = new GroceryStore();
double houstonStoreRevenue = ( houstonStore.applesSold * houstonStore.applesPrice) + (houstonStore.orangesSold * houstonStore.orangesPrice);
double orlandoStoreRevenue = (orlandoStore.applesSold * orlandoStore.applesPrice) + (orlandoStore.orangesSold * orlandoStore.orangesPrice );
double seattleStoreRevenue = (seattleStore.applesSold * seattleStore.applesPrice) + (seattleStore.orangesSold * seattleStore.orangesPrice);
houstonStore.applesSold = 534;
houstonStore.applesPrice = 0.99;
houstonStore.orangesSold = 429;
houstonStore.orangesPrice = 0.87;
System.out.println("The Houston store revenue is: " + houstonStoreRevenue);
seattleStore.applesSold = 765;
seattleStore.applesPrice = 0.86;
seattleStore.orangesSold = 842;
seattleStore.orangesPrice = 0.91;
System.out.println("The Seattle store revenue is: " + seattleStoreRevenue);
orlandoStore.applesSold = 402;
orlandoStore.applesPrice = 0.79;
orlandoStore.orangesSold = 398;
orlandoStore.orangesPrice = 0.77;
System.out.println("The Orlando store revenue is: " + orlandoStoreRevenue);
}
}
class class GroceryStore {
int applesSold;
double applesPrice;
int orangesSold;
double orangesPrice;
}
Я не совсем понимаю, почему я получаю ответ ниже
*****
The Houston store revenue is: 0.0
The Seattle store revenue is: 0.0
The Orlando store revenue is: 0.0