Results 1 to 2 of 2
Thread: Help Java Methods
- 11-27-2013, 04:22 AM #1Member
- Join Date
- Jul 2013
- Rep Power
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)
- 11-27-2013, 05:16 AM #2
Re: Help Java Methods
Post what you've tried and ask specific questions.Get in the habit of using standard Java naming conventions!
- By ajaysharma in forum Advanced JavaReplies: 2Last Post: 07-12-2012, 11:04 PM
- By dreamingofgreen in forum New To JavaReplies: 8Last Post: 04-16-2012, 11:00 PM
- By gabrielpr12 in forum New To JavaReplies: 8Last Post: 11-17-2011, 10:07 PM
- By venkatch in forum New To JavaReplies: 1Last Post: 10-23-2011, 12:37 PM
- By 5minutes in forum New To JavaReplies: 1Last Post: 10-05-2011, 12:15 AM