|Question||This project is the first timeyou’ll create your own objects, along with private data, methods,etc. This isn’t a complete working system with a user interface;it’s just a chance for you to create classes, then instantiate andtest them. You’ll create two classes thatinteract with each other (through a “has a” relationship).
Here are UML Class Diagrams for theobjects you are to create. Pay attention to the diagram notationindicating whether methods are public (+) or private (-); askquestions if you need clarification. Understanding the model is of importance here.
3 Constraints and Assumptions
• Create staticmethods except for the test methods.
• Mark instance variable and method as either public orprivate; follow the UML where it gives guidance and make smartdecisions where it doesn’t.
• Use exactly the methodnames shown. Look carefully at the parameter data types and thereturn data types; they give you clues.
• Department’s addStudentmethod maintains the appropriate total students of each group andthe total balance.
• Department’s getTotalGr…methods calculate how many groups need for each class (28 studentsin the class).
• The toString method shoulddo their best to summarize the state of the object instance inquestions; include newlines in the strings to make the resultdisplayable and attractive.
• Create a test method foreach class that checks every constructor and every method excepttoString.
• One credit equals 5, and onecredit costs $110.
• Throw anIllegalArgumentException if any of these preconditions areviolated:
o A first name, last name, and IDcan’t be empty.
o Total students of each group can’tbe negative.
The testing required here is significant. You may spend as muchtime writing your tests as you do writing the entire rest of thecode. Your test code needs to test everything (or nearlyeverything), your object can do; don’t treat it lightly. Don’tforget to test constructors and preconditions. And don’t forgettest code is and can have bugs, so besuspicious if everything passes miraculously the first time, i.e.,test that you can induce failures and get the appropriate errormessages shown.
Don’t duplicate code; avoid this wherever possible. As anexample, don’t forget it’s legal for one constructor to callanother constructor; this is good practice and s avoidduplication and the creation of extra code paths to test.
The name: Name LastName ID: 123456789 The chosen class: CSC142 Credits: 5 Credit Price: 110.0 The balance: 550.0