Question: Write a program that declares three arrays named price, quantity, and amount. Each array should be declared inside of the method main() and capable of
Write a program that declares three arrays named price, quantity, and amount. Each array should be declared inside of the method main() and capable of holding just 3 values. Initialize the price and quantity array using an Initializer list of your own values.
Write a method called calcultateAmount (inside of the ShoppingCart class, but outside of the method main. This method should be static) to calculate the amount array with the product of the corresponding elements in price and quantity.
Write another method called displayArrays (inside of the ShoppingCart class, but outside of the method main. This method should be static) to display the values in the three arrays.
In the main method, after the arrays have been created and initialized, call the calculateAmount method and then the displayArrays method.
Next, allow users to change the price and quantity for three items. Call the methods again to calculate and display the arrays.
Can anyone help me figure out the skeleton of this particular code? Thanks!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
