java arrays 2

you will create a new class, GenEdData, that will have an array with all the general education requirements, and some methods to add functionality to the class.

Classes

lab04_240.png

Lab Description

The GenEdData Class

  • One constructor
    • with no parameters
      • Creates an Array [ ] of GenEd objects
      • Create 9 objects and add them to the array using the following data
"Writing Speaking", "GWS", 3_x000D_
"Quantification", "GQ",3_x000D_
"Arts", "GA",3_x000D_
"Humanities", "GH",3_x000D_
"Health and Wellness", "GHW",3_x000D_
"Natural Sciences", "GN",3_x000D_
"Social and Behavioral Sciences", "GS",3_x000D_
"United States Cultures", "US",3_x000D_
"International Cultures", "IL",3_x000D_
"Writing Across the Curriculum", "WAC",3
  • The methods
    • public boolean contains(String s)
      • checks if the String is contained either in the code or the description of the GenEd objects in the array
      • for instance, “Sciences” will return true for the objects below
        • “Natural Sciences”, “GN”,3
        • “Social and Behavioral Sciences”, “GS”,3
      • It returns true if the String s is contained in the array
      • it returns false if the String s is not contained in the array
    • public GenEd find(String s)
      • checks if the String matches either the code or the description of the GenEd objects in the array
      • for instance, “Natural Sciences” (a description) or “GS” (a code) will return true for the objects below
        • “Natural Sciences”, “GN”,3
        • “Social and Behavioral Sciences”, “GS”,3
      • It returns the GenEd object if the String s matches an element in the array
      • it returns null if the String s does not match an element in the array

The app class

  1. create one GenEdData object
  2. Test the contains method in the GenEdData object using the data below
    1. Writing
    2. writing
    3. The possible messages are
      1. if the method returns true, display “input string ” is on the GenEd Table
      2. if the method returns false, display “input string ” is NOT on the GenEd Table
  3. Test the find method in the GenEdData object using the data below
      1. abcd
      2. GHW
      3. International Cultures
      4. The possible messages are
        1. use toString to display the data from the object that was returned by the method
        2. If the returned object is null, display “input string ” is NOT on the GenEd Table

Other Classes

  • GenEd: same as in previous assignments.

Output

The output should be similar to

Writing is on the GenEd Table_x000D_
writing is NOT on the GenEd Table_x000D_
abcd is NOT on the GenEd Table_x000D_
Health And Wellness  (GHW)  3_x000D_
International Cultures (IL) 3

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
Looking for a Similar Assignment? Our Experts can help. Use the coupon code SAVE30 to get your first order at 30% off!

Hi there! Click one of our representatives below and we will get back to you as soon as possible.

Chat with us on WhatsApp