Skip to content

Instantly share code, notes, and snippets.

@edinak1
Created November 24, 2015 16:27
Show Gist options
  • Save edinak1/5ecbff9b8544bfbf0515 to your computer and use it in GitHub Desktop.
Save edinak1/5ecbff9b8544bfbf0515 to your computer and use it in GitHub Desktop.
package masivDuos;
public class Teacher {
public static void main(String[] args) {
String[][]ivanov={{"Ivanov Ivan"},
{"Bio-60 hours ","1,2,3,4,2,4"},
{"Geo-65 hours ","5,4,3,5,4"},
{"Math-120 hours","5,4,3,5,4,5"}};
String[][]sidorov={{"Sidorov Semen"},
{"Bio-60 hours ","1,2,3,4,2,4"},
{"Geo-65 hours ","5,4,5,5,4"},
{"Math-120 hours","5,4,3,5,4,5"}};
String[][]petrov={{"Petrov Petr"},
{"Bio-60 hours ","2,4,2,4"},
{"Geo-65 hours ","5,4,3,5,4"},
{"Math-120 hours","5,4,4,5,4,5"}};
balls(ivanov);
problemSabject(sidorov);
excellentSabject(petrov);
}
static void balls(String[][]name)
{
System.out.print("All balls ");
for(int i=0;i<name.length;i++)
for(int j=0;j<name[i].length;j++)
System.out.println(name[i][j]);
System.out.println("*************");
}
static void problemSabject(String [][]name)
{
System.out.println("Problem subject for "+name[0][0]);
for(int i=1;i<name.length;i++)
{
for(int k=0;k<name[i][1].length();k+=2)
{
if((name[i][1].substring(k,k+1)).equals("3")||
(name[i][1].substring(k,k+1)).equals("2")||
(name[i][1].substring(k,k+1)).equals("1"))
{
System.out.print(name[i][0]+" ");
System.out.println(name[i][1]);
break;
}
}
}
System.out.println("*************");
}
static void excellentSabject(String [][]name)
{
boolean flag=true;
System.out.println("Exelent balls "+name[0][0]);
for(int i=1;i<name.length;i++)
{
for(int k=0;k<name[i][1].length();k+=2)
{
if((name[i][1].substring(k,k+1)).equals("3")||
(name[i][1].substring(k,k+1)).equals("2")||
(name[i][1].substring(k,k+1)).equals("1"))
{
flag=false;
}
}
if(flag)
{
System.out.print(name[i][0]+" ");
System.out.println(name[i][1]);
}
flag=true;
}
System.out.println("*************");
}
}
Enter file contents here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment