Answer:
public static void main(String[] args)
{
int studentnumber = 123456;
int divisor = 0;
int chapter = (studentnumber%4)+2;
switch(chapter) {
case 2:
divisor = 23;
break;
case 3:
divisor = 34;
break;
case 4:
divisor = 38;
break;
case 5:
divisor = 46;
break;
}
int exercise = (studentnumber % divisor) + 1;
System.out.printf("Studentnumber %d divided by 4 plus 2 is chapter %d.\\", studentnumber, chapter);
System.out.printf("Studentnumber %d divided by %d is exercise %d.", studentnumber, divisor, exercise);
}
Step-by-step explanation:
Above is just a bit of code to get you started with the first part. Hope you can figure out the rest.