Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

Creating and Using a Class – CourseName

Creating and Using a Class – CourseName

Creating and Using a Class – CourseName

Question Description

You will create a CourseName class and many instances (objects) from this class. You will also display the data from each instance/object.

lab02_240.png

The CourseName Class

  1. the attributes
    1. String major
    2. String number
    3. String complement
  2. two constructors
    • one complete with all parameters, one for each attribute
    • one with no parameters
      • the default values should be
        • “IST”
        • “000”
        • “?”
  3. a toString() method that will display information about the object
    • you can use the Netbeans automatic builder format
  4. The “get/set” methods
    1. The checks below should be done in each set method.
    2. Make sure that you also check it when you create the object in the constructor.
    3. The set method for major
      • All the letters should be upper case. Correct them if they aren’t
      • Get rid of spaces at the beginning or at the end of the input string
      • Check if the major is one of the following list
        • CMPSC, COMM, CYBER, DS, ECON, ENG, IST, MATH, SRA or STAT
        • if it is not correct it to the default value “IST”
    4. The set method for number
      • It has to have 3 digits.
      • Add “0”s to the beginning if it is not.
      • For instance, if the user tries to add a number “1”, correct it to “001”
      • For instance, if the user tries to add a number “25”, correct it to “025”
      • For instance, if the user tries to add a number “”, correct it to “000”
    5. The set method for complement
      • The letters should be upper case. Correct them to upper case if they are not.
      • It should have only one letter
        • If it has more than one letter, , drop any extra letters beyond the first.
        • if it has less than one letter, set it to the default value “?”
      • Get rid of spaces at the beginning or at the end of the input string
      • Check if the complement is one of the following list
        • A, B, C, D, E, H, M, N, S, T, W, or Z
        • if it is not, correct it to the default value “?” (question mark).
        • Remember that you will need to check the input values for the other 2 attributes (which you probably did already)

The app class

  1. create CourseName objects with the data below
    1. using the default/no parameter constructor
    2. ds, 111, n
    3. ist, 1, honors
    4. abc,100, N
    5. SRA, 20, “” (no spaces)
    6. Cyber, 101, J
  2. display each object using the toString( ) method

Output

The output should be similar to

CourseName{major=IST, number=000, complement=?}CourseName{major=DS, number=111, complement=N}CourseName{major=IST, number=001, complement=H}CourseName{major=IST, number=100, complement=N}CourseName{major=SRA, number=020, complement=?}CourseName{major=CYBER, number=101, complement=?}

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20