Results 1 to 2 of 2
  1. #1
    Yappie is offline Member
    Join Date
    Jul 2013
    Rep Power

    Default 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)

    Problem Statement:
    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
    BLIS xx
    BSCS xx
    BSIM xx
    BSIT xx

    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)

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Tucson, AZ
    Rep Power

    Default Re: Help Java Methods

    Post what you've tried and ask specific questions.
    Get in the habit of using standard Java naming conventions!

Similar Threads

  1. Replies: 2
    Last Post: 07-12-2012, 11:04 PM
  2. Replies: 8
    Last Post: 04-16-2012, 11:00 PM
  3. Java Noob, trying to call methods from another methods
    By gabrielpr12 in forum New To Java
    Replies: 8
    Last Post: 11-17-2011, 09:07 PM
  4. Replies: 1
    Last Post: 10-23-2011, 12:37 PM
  5. Replies: 1
    Last Post: 10-05-2011, 12:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts