I need help with this java programming task, where I´m supposed to create 4 vers
ID: 3668942 • Letter: I
Question
I need help with this java programming task, where I´m supposed to create 4 versions of a program (I´m going to commit the 0.1 version into GIT, and also commit the 0.2 version to GIT and do a "merge" towards master for version 0.2 (and the same for version 0.3 and 0.4. I´m new to GIT, but I mainly need help with writing the program below). (I`ll make sure to give you a "thumb`s up"):
Version 0.1:
A college is going to get a new key card system, and a system designer has proposed an idea to how to create the program to operate the system:
An abstract class Card is going to contain the cardholders first and last name, PIN code, card number and an access code that specifies wheter the card is cancelled or not.
The class is going to have at least the following constructor and methods:
-A constructor that puts all data members to the preferred values. Let the class itself generate unique card numbers (use a static variable). The variable cancelledCard is set to false, which specifies that a brand new card is open.
-The method String getName() which returns the name of the cardholder.
-The method boolean IsCancelled() which returns whether the card is cancelled or not.
-A String toString() method that prints all the data members of the card.
-An abstract method boolean checkPIN(int pin).
Write the program code for the Card class.
Version 0.2:
The program is further developed, there has been proposed new suggestions, and you (as a developer) is making a prototype.
-There is a need to be able to distinguish between employees and guests. Guests are handed a card where the PIN code is always 9999, but the card is time limited; that is, it`s only valid one week after it`s made.
-An employees card is always valid throughout the office hours (between 07:00 and 17:00 from Monday to Friday). Besides office hours the employees has to type their PIN code (the card is not expiring due to time limitations).
-Cancelled cards can not give access to employees nor guests.
Based on this information; create two new classes Employee and Guest. Create the method boolean checkPIN(int pin) which works as described above. Add extra data members and methods/constructors in the classes to make this work, if necessary.
Version 0.3:
Define an interface Constants with the following methods:
- setFirstname(String) and String getFirstname() to be able to set and get the first name.
-setLastname(String) and String getLastname() to be able to set and get the last name.
-setFullName(String) and String getFullName() to be able to set and get the persons full name. The argument of the set method is going to be the first name and the last name separated by blank space.
-double computeCredit() is computing the credit as a constant multiplied with salary earned per hour.
-double computeBonus() is computed as a constant multiplied with the number of years the employee has worked there ("seniority").
The Employee class is going to implement the interface Constants. Add new data members in the Employee class if necessary.
Version 0.4
To be able to compare Card objects, e.g to sort a list of employees and guests, the Card class is going to implement the interfaces Comparable<Card> and Cloneable.
The Card objects is compared based on full name, first by last name, and then by first names if the last names are identical. This can be done by letting the Card class implement the method int compareTo (Card k) with the following logic:
-If the last names are different the method is:
-returning a negative integer if the first last name is alphabetically ordered before the other.
-or a positive integer if the opposite.
-If the last names is identical, the method is going to do the same as above for the first names. If the first names also is identical, the method is returning 0.
Hint: To compare two String objects one can use the String class`s built in Comparable method int compareTo(String streng2). This method is comparing one String with another alphabetically.
Explanation / Answer
}
}
public class User { private String id; private String email; private String mobilenumber; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getMobilenumber() { return mobilenumber; } public void setMobilenumber(String mobilenumber) { this.mobilenumber = mobilenumber; } @Override public String toString() { return id+"::"+email+"::" +mobilenumber; }}
public class Address { public String id; public String email; public String addressline1; public String addressline2; public String mobilenumber; public String zipcode; public String locality; public String city; public String state; public String nationality;}