This discussion is now closed.
import java.io.PrintStream;
import java.util.Formatter;
class HalfDollars {
public static void main(String[] arguments) {
int[] denver = { 2500000, 2900000, 3500000 };
int[] philadelphia = new int[denver.length];
int[] total = new int[denver.length];
int average;
philadelphia[0] = 2500000;
philadelphia[1] = 2900000;
philadelphia[2] = 3800000;
total[0] = denver[0] + philadelphia[0];
total[1] = denver[1] + philadelphia[1];
total[2] = denver[2] + philadelphia[2];
average = (total[0] + total[1] + total[2]) / 3;
System.out.print("2003 production: ");
System.out.format("%,d%n", total[0]);
System.out.print("2004 production: ");
System.out.format("%,d%n", total[1]);
System.out.print("2005 production: ");
System.out.format("%,d%n", total[2]);
System.out.print("Average production: ");
System.out.format("%,d%n", average);
}
}
System.out.println("2003 production: " + total[0]);
Last reply 3 weeks ago
University blocked ethernet because of personal routerLast reply 1 month ago
How do you know if someone's account got hacked or suspended???Last reply 1 month ago
Do you mind foreigners posting stuff in their language on social media?Last reply 4 months ago
My family say I’m stupid for not wanting to spend more than £1.1k on a laptop