Created
January 28, 2016 06:17
-
-
Save Yur-ok/59484bdb6fbccb97f436 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
package Lesson3.KeyPoint5; | |
import jdk.nashorn.internal.ir.IfNode; | |
import java.util.Arrays; | |
/** | |
* Created by Юрий on 14.01.2016. | |
*/ | |
public class StructureOfData { | |
static String[][] subjects = {{"Math", "120 h:"}, {"History", "80 h:"}, {"Geography", "90 h:"}}; | |
static String[][] students = {{"Petrov", "Ivan","4","3","5"}, {"Sokolov", "Alexey","5","4","4"}, {"Fedorov", "Michail","3","5","4"}}; | |
public static void main(String[] args) { | |
getData("Math"); | |
// getSomeEval("Petrov Ivan", 3); | |
} | |
static void getData(String subject) { | |
int subIdx = 0; | |
int subEval = 0; | |
if (subject == "Math") { | |
subIdx = 0; | |
subEval = 2; | |
} else if (subject == "History") { | |
subIdx = 1; | |
subEval = 3; | |
} else if (subject == "Geography"){ | |
subIdx = 2; | |
subEval = 4; | |
} | |
System.out.println(Arrays.toString(subjects[subIdx])); | |
System.out.println("***************************"); | |
for (int i = 0; i <= students.length - 1; i++) { | |
for (int j = 0; j < 2; j++) { | |
System.out.print(students[i][j] + " "); | |
} | |
System.out.print("- "); | |
System.out.print(students[i][subEval] + ":"); | |
System.out.println(); | |
} | |
System.out.println("==========================="); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment