Question: Java General Requirements 1. This assignment can be completed EITHER in a group of 2 or individually (your choice). 2. Analyze the problem, it is
Java



General Requirements 1. This assignment can be completed EITHER in a group of 2 or individually (your choice). 2. Analyze the problem, it is recommended (but not required, will not be graded) to develop a plan your solution using a flowchart or pseudo code. 3. Submit your solution to the appropriate assignment folder on DC Connect by the due date provided. 4. Your instructor will assign a grade and post feedback on your submission to DC Connect. 5. Note: Each class needs comments at the top with at minimum your name(s), the date (date created or date due), a description of what the class does. In addition, it is expected that you provide a sufficient amount of commenting in your code. Requirements Complete and submit the program source code that satisfies the following requirements: For this assignment you are going to create two java classes/files, one named CreditCard.java and another named CardTester.java 1. The CreditCard.java will be used to create objects of this type, this class should have the following components (Note: this class will not have a main() method) : a. An attribute of type long to store the credit card number, named accountNumber (access type should be private) b. An attribute of type int to store the credit card's expiration month, named month (access type should be private) c. An attribute of type int to store the credit card's expiration year, named year c. An attribute of type int to store the credit card's expiration year, named year (access type should be private) d. An attribute of type String to store the credit card holder's name, named holder (access type should be private) e. A constructor that accepts four arguments, of the types listed above, that places each argument into it's appropriate attribute f. A default constructor (i.e. one that does not take any arguments), that will set the attributes to the private class values listed below. g. A class variable named DEFAULT_NAME of type String, that contains the value "Bob Loblaws" (access private) h. A class variable named DEFAULT_MONTH of type int, that contains the value 1234567890123456 (access private) i. A class variable named DEFAULT_MONTH of type int, that contains the value 1 (zero) (access private) j. A class variable named DEFAULT_YEAR of type int, that contains the value 99 (access private) k. One additional class attribute named ACCOUNT_NUMBER_LENGTH that is of type long and that contains the value 16 , this number should have public access I. Create a instance method (i.e. non-static) named displayCardInfo() that will display a specific credit card's information in the form (it does not have to return anything): Card Holder Name Account Number Month/year (Note: use a decimal format object to ensure that single digit month and years display a leading zero). i.e. January - month 1 - is displayed "01" m. A last method named verifyAccountNumber() that returns a boolean (primitive), that checks, using ACCOUNT_NUMBER_LENGTH, whether the number in an objects accountNumber attribute is valid. Hint: for this method you will have to use a Wrapper class. Specifically that converts the long stored into a String, and then you can compare the String's length to the class variable's length
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
