Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA The CourseName Class the attributes String major String number String complement two constructors one complete with all parameters, one for each attribute one

IN JAVA

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 15th International Conference Dasfaa 2010 Tsukuba Japan April 2010 Proceedings Part 1 Lncs 5981

Authors: Hiroyuki Kitagawa ,Yoshiharu Ishikawa ,Wenjie Li ,Chiemi Watanabe

2010th Edition

3642120253, 978-3642120251

More Books

Students also viewed these Databases questions

Question

How do private and public financial markets differ?

Answered: 1 week ago

Question

to encourage a drive for change by developing new ideas;

Answered: 1 week ago

Question

4 What are the alternatives to the competences approach?

Answered: 1 week ago