i see a lot of problems in your main :
public class TestShoppingCart {
public static void main(String [] args){
//first i'd create an array of carts not 2 seperatly named carts (ill come back to this a bit lower)
ShoppingCart newCartOne = new ShoppingCart(totalcost);
//totalcost doesnt exist in this scope, it was never declared nor initiated.
ShoppingCart newCartTwo = new ShoppingCart(totalcost); //same thing here
//the array variables productNames , itemCost and shoppingCartQuantity were all declared in the LineItem class and can't be used outside of their scope , thus are unavailable here
LineItem shoppingCartTest = new LineItem(productNames[], itemCost[], shoppingCartQuantity[]); the whole idea between your LineItem class is wrong, it shouldn't hold arrays, just single Strings, then your carts class should have LineItem arrays in them (not use the same out of scope array variables from LineItem like you're doing now)
here if you built an array of carts those numbers could be 0 or 1 to determine the cart index(or keep 1 and 2 but substract 1 when using to get the index)
also youl need a kind of do-while structure here to keep coming back here untill your done filling carts
exemple choices : 1)put something in a cart 2)see a cart's content 3)quit
choices 1 and 2 ask which cart (cart1 or cart2)
after choosing a cart for option 1 then display the list of items, ask which the user wants to add, how many, and add it to the corresponding cart, then move on to the next while loop to start over from main menu...
Scanner userInput = new Scanner(System.in);
System.out.println("Please select your shopping cart: \nFor cart 1 enter integer 1.\nFor cart 2 enter integer 2.");
int userCart = userInput.nextInt();
//that for is flawed, shopping quantity is out of scope, and irrelevant to the ammount of items you want to store in carts
for (int x = 0; x < shoppingCartQuantity.length; x++){
System.out.println("How many " + productNames[x] + "Would you like? Enter an Integer: ");
shoppingCartQuantity[x] = userInput.nextInt();
}
//do the displaying in a method and execute that method only when user chooses to do so from a menu
newCartOne.getCartDisplay();
newCartOne.getTotalCost();
newCartTwo.getCartDisplay();
newCartTwo.getTotalCost();
}
}
the shopping cart fucntion needs rethinking, it doesnt have a LineItem list, and uses arrays that are private variables from LineItem class.
LineItem class needs rethinking, don't use arrays, see the class as 1 single item, be it a bannana or an apple, but not the whole contents of the cart. also the "number of items" would be more appropriate somewhere in the structure of your cart class, but the project's description seems to want you to keep it there so keep it there.
Good luck, let me know how your doing after the few improvements i suggested.