Created
June 11, 2015 18:08
-
-
Save ashwinb/eb7a6fa728cbb7da5a59 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Sales { | |
public static void main(String[] args) { | |
float[] allSales = new float[24]; | |
int division; | |
Scanner input = new Scanner(System.in); | |
for (division = 0; division < 6; division++) { | |
Sales.readData(input, allSales, division); | |
} | |
// process all the data now in loops | |
} | |
public static readData(Scanner input, float[] data, int division) { | |
System.out.printf("ENTER THE SALES FOR DIVISION %d\n", division); | |
int i = 0; | |
int start_position = division * 4; | |
for (i = 0; i < 4; i++) { | |
System.out.printf("Enter sales for quarter: %d\n", i + 1); | |
data[start_position + i] = input.nextFloat(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment