Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class aspergerPeople {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- String names[] = {"Olivia", "Jack", "Aidan", "Nina", "Cedric"}; //people with Asperger's Syndrome
- String bestRoutine[] = {"watch the best films more than once a year", "sort batteries", "eat certain meals", "doodle after homework", "take a walk at 4 o'clock in the morning"}; //what has to be repeated in their daily life
- String specialInterest[] = {"Painting", "Batteries", "Astronomy", "Fennec foxes", "Maths"}; //what are their intense beloved interests
- String worstDifficulty[] = {"school", "having to talk about absolutely talentless things that interest others", "avoiding eye-contact", "making friends", "saying things that sound rude to others"}; //what are their social problems
- int ageOfDiagnosis[] = {12, 9, 15, 10, 19}; //when were they diagnosed with AS
- printInventory(names, bestRoutine, specialInterest, worstDifficulty, ageOfDiagnosis);
- } //main ends here
- static void printInventory(String[] names, String[] bestRoutine, String[] specialInterest, String[] worstDifficulty, int[] ageOfDiagnosis)
- {
- for(int i=0; i<names.length; i++)
- {
- for(int j=1; j<(names.length-i); j++)
- {
- if(names[j-1].compareTo(names[j])<0)
- {
- String temp1 = names[j-1];
- names[j-1] = names[j];
- names[j] = temp1;
- String temp2 = bestRoutine[j-1];
- bestRoutine[j-1] = bestRoutine[j];
- bestRoutine[j] = temp2;
- String temp3 = specialInterest[j-1];
- specialInterest[j-1] = specialInterest[j];
- specialInterest[j] = temp3;
- String temp4 = worstDifficulty[j-1];
- worstDifficulty[j-1] = worstDifficulty[j];
- worstDifficulty[j] = temp4;
- int temp5 = ageOfDiagnosis[j-1];
- ageOfDiagnosis[j-1] = ageOfDiagnosis[j];
- ageOfDiagnosis[j] = temp5;
- } //if statements end here
- } //inner loop ends here
- } //outer loop ends here
- for(int i=0; i<names.length; i++)
- {
- System.out.println("Meet this person with Asperger's Syndrome: " + names[i] + ", diagnosed at the age of " + ageOfDiagnosis[i] + ". Biggest difficulty: " + worstDifficulty[i] + ". Special interest: " + specialInterest[i] + ". Most significant routine: " + bestRoutine[i]);
- }
- }
- } //program ends here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement