Hey, my program is supposed to display stores, their unique identification number, and their income. I realize that my code doesn't accurately demonstrate the program intended.
My test code says that the error is in bold saying that "the variable storeID might not have been initialized."
import javax.swing.JOptionPane; import java.text.DecimalFormat; import java.text.NumberFormat; public class store { public static void main(String[] args) { payroll storeID[]; DecimalFormat df = new DecimalFormat("#,##0.00"); NumberFormat nf = NumberFormat.getCurrencyInstance(); double income; byte currentStore; currentStore = 0; //Used to store the data in the arrays in the future. while(currentStore <= 7) { JOptionPane.showMessageDialog(null, [B]storeID[currentStore],[/B] "Store " + storeID[currentStore], JOptionPane.PLAIN_MESSAGE); currentStore += 1; } } }
public class storeSource { //Number of stores public final int num_stores = 7; //Creates an array to hold the store's identification number. private int[] storeID = {5658845, 4520125, 7895122, 8777541, 8451277, 1302850, 7580489}; //Creates an array to hold the total income that each store earns. private double[] wages = new double[num_stores]; }
Can I gain some insight with this?