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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!