The following piece of Java program calculates the subtotal and average amount of five items sold in
Fantastic news! We've Found the answer you've been seeking!
Question:
The following piece of Java program calculates the subtotal and average amount of five items sold in a store. The quantity and unit price of the five items are stored in two array named qty and price respectively. The subtotal of each item will be stored in array subt after calling the method subTotal().
int[] qty = {60, 400, 25, 121, 980}; double[] price = {5.2, 0.25, 28.5, 90, 3.2}; double subt[] = new double[5]; double total = 0; for (int i = 0; i < qty.length; i++) { subt[i] = subTotal(qty[i], price[i]); //line7 System.out.println(subt[i]); } System.out.print("Average:"); System.out.println(avgPrice(price)); //line11
Related Book For
Contemporary Business Mathematics with Canadian Applications
ISBN: 978-0133052312
10th edition
Authors: S. A. Hummelbrunner, Kelly Halliday, K. Suzanne Coombs
Posted Date: