you can actually use hashmap
write a function which returns hashmap
store your each subject scores in hashmap<K,V> where K is subject name and value is subject score
and in main function u can get...