我在这个程序上做了更多的工作,但现在我被卡住了,因为字符串数组打印了,但我一辈子都无法打印双数组。任何帮助,将不胜感激!
import java.util.ArrayList;
import java.util.Arrays;
import java.lang.Double;
import java.util.Scanner;
public class inventoryTracker
{
private static Scanner sc;
private static double itemCost;
public static void main(String[] args)
{
System.out.println("Welcome to the Inventory tracker"
+ "\nThis program will accept the names and costs for 10 stocked items."
+ "\nThe program will then output a table with the names, costs and,"
+ "\nprices of the items."
+ "\nPrices are calculated with a 30 percent markup on cost.");
sc = new Scanner(System.in);
String[] product = new String[10];
Double[] itemCost = new Double[10];
for (int i = 0; i < itemCost.length; i++ ){
System.out.print("Enter the item cost :");
itemCost [i]= sc.nextDouble();
}
for (int i = 0; i < product.length; i++){
System.out.print("Enter the product name :");
product[i] = sc.next();
}
System.out.println(Arrays.toString(product));
}
}