Question: ****Java**** Write a program thas has 3 different one dimensional arrays for 10 items, *The users inputs the elements price , amount ,TOTAL. and output
****Java****
Write a program thas has 3 different one dimensional arrays for 10 items, *The users inputs the elements
price , amount ,TOTAL.
and output the elements of the "TOTAL" array
TOTAL[ i ] = price [ i ] * amount [ i ]
import java.util.Scanner;
public class Arrays {
public static void main(String[] args) { Scanner input = new Scanner ( System.in); int i,x; double [] price = new double [10]; double [] amount= new double [10]; System.out.println("Enter the price of each obect "); System.out.println("Enter the amount of units for each price"); for ( i =0 ; i < price.length && i< amount.length; i++ ){ price [i] = input.nextDouble(); amount [i] = input.nextDouble(); double [] total = {price[i] * amount[i] } ;
System.out.println( total [i] ); }// loop input.close(); }//main
}// class
** what do I need to output the correct answer ?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
