creating and using a class coursename
You will create a CourseName class and many instances (objects) from this class. You will also display the data from each instance/object.
The CourseName Class
- the attributes
- String major
- String number
- String complement
- two constructors
- one complete with all parameters, one for each attribute
- one with no parameters
- the default values should be
- “IST”
- “000”
- “?”
- the default values should be
- a toString() method that will display information about the object
- you can use the Netbeans automatic builder format
- The “get/set” methods
- The checks below should be done in each set method.
- Make sure that you also check it when you create the object in the constructor.
- 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”
- 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”
- 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
- create CourseName objects with the data below
- using the default/no parameter constructor
- ds, 111, n
- ist, 1, honors
- abc,100, N
- SRA, 20, “” (no spaces)
- Cyber, 101, J
- display each object using the toString( ) method
Output
The output should be similar to
CourseName{major=IST, number=000, complement=?}_x000D_ CourseName{major=DS, number=111, complement=N}_x000D_ CourseName{major=IST, number=001, complement=H}_x000D_ CourseName{major=IST, number=100, complement=N}_x000D_ CourseName{major=SRA, number=020, complement=?}_x000D_ CourseName{major=CYBER, number=101, complement=?}
#Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational #accountingassignmenthelp #accountingassignment #assignmenthelp #buyaccountingassignment #accountingassignmentwriter #domyassignment #assignmentguide #expertwriters