Question: This is for java 18) (8 points)Suppose you have created a shoppingcart class and a Fruit class: a) declare an instance variable fruits, that is
18) (8 points)Suppose you have created a shoppingcart class and a Fruit class: a) declare an instance variable fruits, that is an array list of Frust objects in the Shoppingcart class. public ShoppingCart /l declares fruits as an array list of Fruit objects // write a default constructor that initialize the array list to be empty: // write an add method that add a given Fruit object to the array list t count the number of 19)(10 points) Write a static method (include the header and the body) tha "xx" in the given string, overlapping is allowed, so countXX("abexx") returns 1 countXX("xxx") returns 2 countXX("xxxx") returns 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
