public class Strings {
public static void print_array(int[] potato) {
int x;
for (x = 0; x < potato.length; x++) {
int y = 0;
System.out.println("potato["+x+"] = " + potato[x]);
}
}
public static void main(String[] args) {
double cost = 0.0, price, sub;
int count;
for (String a : args) {
System.out.println(a);
String parts[] = a.split("@");
for ( String p : parts)
System.out.println(p);
count = Integer.parseInt(parts[0]);
price = Double.parseDouble(parts[1]);
sub = count * price;
System.out.printf("%d @ %.2f = %.2f%n", count, price, sub);
cost = cost + sub;
}
System.out.printf("The total cost is $%.2f%n", cost);
}
}