NOTE: I cant use any advanced java techniques or anything outside my learnt boundary so im stuck
Question:
NOTE: I cant use any advanced java techniques or anything outside my learnt boundary so im stuck with using loops to search through do the validity check and either proceed with adding enrolment or giving input error... so the method newEnrolment() takes userinput student number and then subject code and then is suppose to check both against their respective arraylists attributes.. e.g. if the user entered student number matches a student number of one of the student objects in its arraylist and if the user entered subject code matches a subject code of one of the subject objects in its arraylist only then it does
"enrolments.add(enrolment1);" in any other case gives validity check error i have tried alot of loop types and this was the solution i came up with which is closest to required solution. stil the else if statement for the error either doesnt work at all or with added -1 works even with correct input.. wanna learn how can i get through this. ive spent 2 days on this only..and i dont have alot of time
i just added the method i need help with and global variables. the class is a bit longer so didnt send as i rekon it wont be needed to solve this problem if im still missing anything do let me know thankss alot ::::::::::::::::::::::::::::CODE:::::::::::::::::::::::::::::
public class StudentEnrolmentSystem { private ArrayList students; private ArrayList subjects; private ArrayList enrolments; public void newEnrolment(){ Scanner Input = new Scanner(System.in); System.out.println("Input a student number:"); int newstu=0; int stu=Input.nextInt(); for (int i=0 ; i
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill