Skip to content

Instantly share code, notes, and snippets.

@AndresRodz
Created December 2, 2013 04:43
Show Gist options
  • Save AndresRodz/7745192 to your computer and use it in GitHub Desktop.
Save AndresRodz/7745192 to your computer and use it in GitHub Desktop.
Larry graduated this year and finally has a job. He's making a lot of money, but somehow never seems to have enough. Larry has decided that he needs to grab hold of his financial portfolio and solve his financing problems. The first step is to figure out what's been going on with his money. Larry has his bank account statements and wants to see …
import java.util.Scanner;
import java.io.*;
import java.text.DecimalFormat;
public class FinancialManagement {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
double[] money;
money = new double[12];
double meanMoney = 0;
for (int i = 0; i < 12; i++) {
money[i] = input.nextDouble();
}
for (int x = 0; x < 12; x++) {
meanMoney = meanMoney + money[x];
}
meanMoney = meanMoney / 12;
System.out.println("$" + meanMoney);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment