이 프로그램에서 좀 더 많은 작업을했는데 문자열 배열이 인쇄되기 때문에 멈추었습니다.하지만 인쇄 할 때 이중 배열을 얻지 못했습니다. 어떤 도움을 주시면 감사하겠습니다!double 배열이 인쇄되지 않습니다
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));
}
}
당신이 할당의 정확한 표현을 게시하시기 바랍니다 수 있습니까? 너는 그것을 잘못 해석했을지도 모른다. – RealSkeptic
문자 그대로 말하자면 "병렬 배열"같은 것은 없습니다. @RealSkeptic이 말했듯이, 과제의 전체 텍스트를 표시하십시오. – fge