Help Java Methods
I have problems on java methods. i really cant get the logic out of this activity.
here's the problem
IT 122 Programming Fundamentals 2
Programming 1 Review Problem (Modular Approach)
Write a program that reads the ID number and course of some CICS students. Data input is
terminated by an ID number of 0 (sentinel value). Tally (format shown below) and output as follows:
Total Students: xx
Course Number of Students
1. The main method must invoke the methods below as part of your answer:
inputStudInfo asks the user for the ID number and course. It shall repeatedly ask for
a valid ID number (non-negative integer value) if an invalid input is entered. Input for a
valid course will also be asked repeatedly by this method until a valid value (see above
for the list of accepted courses) has been entered by the user. This method shall return
the valid course entered by the user or shall return the word END if the user entered 0
as input for the ID number.
convertCourse converts the course, taken as parameter, into its equivalent character
value as follows:
o BLIS -> L
o BSCS -> C
o BSIM -> M
o BSIT -> T
showSummary takes the values of the frequencies (count) for the different courses
as arguments and outputs these values following the format shown above.
2. The main method must evaluate the return value of the inputStudInfo method:
a. If the value returned is END, show the output by calling showSummary method.
b. If the value returned is not END, call convertCourse method and use the return value
in tallying the running count of students per course by using the switch statement.
Testing for String equality must be done through a method call, such as:
college.equals(CICS) // where college is a String variable
The expression above yields a case-sensitive comparison but comparison where cases are ignored can be
done through another method call, like:
college.equalsIgnoreCase(CICS) // where college is a String variable
Alternatively, we can produce the same result of comparison using the compareTo and
compareToIgnoreCase method calls. (See the Java API documentation for further information)
Re: Help Java Methods
Post what you've tried and ask specific questions.