Answer:
import java.util.*;
public class Orders {
public static void compute() {
Scanner sc = new Scanner(System.in);
System.out.print("Enter number of orders: ");
int numOrders = sc.nextInt();
double total = 0.0;
double grandTotal = 0.0;
for (int i = 0; i < numOrders; i++){
System.out.print("Enter number of items for order #" + (i+1) +": ");
int numItems = sc.nextInt();
for (int j = 0; j < numItems; j++){
System.out.print("Enter price for item #" + (j+1) + ": ");
double price = sc.nextDouble();
total += price;
}
grandTotal += total;
System.out.println("Total price for this order: " + total);
}
System.out.println("Grand Total price for all orders: " + grandTotal);
}
public static void main(String[] args){
compute();
}
}
Explanation: