Skip to main content

[SOLVED] Key card system in Java according to the different 4 versions with full source code

The university is going to get a new key-card system and a system designer has come up with a suggestion on how to make the program that is going to operate the system – one abstract class «Card» that need to contain card holers first and last name, PIN code, card number and a boolean variable that checks if the card is working/blocked.

Version 0.1:
The class should minimum have following constructor and methods:
One constructor that sets all data members (possibly datafields) to desired values. Let the class itself generate unique card numbers (use a static variable that as you use to pick a card number). The variable blockedCard is set to false, which indicates open for a new card.
Method String getName() that returns card holders name.
Method booleon isBlocked() that returns if the card is blocked or not.
One String toString() method that writes out all of the cards data members.
One abstract method boolean checkPIN(int pin).
Write the code for the class Card. Additional methods is written as needed. The first version of this card-class is version 0.1. Do a push of this to *school website* as branch v0.1.

Version 0.2:
The program will be further developed, and new suggestions have come in, that you as a developer is responsible for a prototype. Make a branch in GIT and give this the name v0.2
There will be a need to distinguish between employees and guests. A guest will be given a card where the cardholder always enter the PIN code 9999, but the card is limited in time by the guest card lasts one week from the date it was made.
An employee's card is always valid during office hours, between the hours. 07:00 and 17:00 (7:00 and 5:00 p.m.) on weekdays. Outside office hours must employee enter his PIN code, but the card does not expire in time.
Blocked cards shall not provide access either for staff or guests.
You should not ask for pin code in checkPin method, this you will be given as a parameter to the method
Based on this information, create two new classes Employee and Guest. Implement the method boolean checkPIN (int pin) which behave as described above. Add any new data members and methods / constructors in classes to get this to work.

This is a test program that tests the class behavior:
public class CardTest {
public static void main(String[] args) {
java.util.ArrayList <card cardArray = new java.util.ArrayList<();
Card c1 = new Employee("Ole Olsen", 1234);
Card c2 = new Guest("Marit Olsen", 9999);
cardArray.add(k1);
cardArray.add(k2);
for (Card card : cardArray) {
System.out.println(card);
System.out.println("Code 1234 is " + (card.checkPIN(1234) ? "valid": "blocked")); System.out.println("Code 9999 is " + (card.checkPIN(9999) ? "valid": "blocked"));}}}

Version 0.3:
Define and interface. Constants with the following methods:
setFirstname(String) and String getFirstname() to set and retrieve first name.
setLastname(String) and String getLastname() to set and retrieve last name.
setFullname(String) and String getFullname() to set and retrieve the persons full name. The argument to set-method should be first and last names separated by spaces. Similarly, the get-method return first and last name separated by a space.
double calculateCredit (), credit is calculated as a fixed factor (constant) multiplied by the hourly rate.
double calculateBonus (), calculated as a fixed factor (constant) multiplied by the number of years of seniority.
The class Employee shall implement the interface. Add new data members in the Employee class as needed. Create a new branch in GIT named v0.3 and create interface. Make necessary changes to Employee class to implement this, add new data members as needed.

Get your solution now 

Buy now

Comments

Popular posts from this blog

The Zoo Management System - entity relationship diagram & MS Access Database

Zoo Management System - Project Details: You are the employee of a big, worldwide working Zoo Management Company. Your company is responsible for the Zoo management. Your boss thinks it would be a great idea to store all data for each Zoo in a brand new self-developed ZOO Management System. Up to now, the ZOO management company has maps of each ZOO available. Your boss knows that you took a course in introduction on an ERP system, so he asks you if you could help designing such a system. Each ZOO must have the same organizational structure, which should look like this: Each Zoo has a Zoo-Address. Each Zoo has many visitors (Visitor Ticket Process (VTP). Many Zoo-Attractions belong to a Zoo. Module 1: Entity Relationship Diagram Design a ER (entity-relationship) diagram for your ZOO Management System. Use the information provided below with the entities and its attributes. Put the entities in the correct relationship to each other (organizational structure). Module 2: DB Implem...

Human Physiology by Stuart Ira Fox [PDF] (12th edition) free download

Student Registration System Web Project using HTML, CSS & PHP

Student Registry System In this task, you’re to further develop the student registry you started on lab-task. The solution is based the on the use of HTML5, stylesheets, and PHP, and will use a database for storage of information, MySQL on (school website) is used for this. Information of students is saved in the table student, ID is primary key and is set In addition to this, you need a table named class where id a is the primary key and is set up with AUTOINCREMENT, other columns and data types in accordance with the figure. The property class in the student table needs to be a foreign key that refers to the ID column in the class table. In MySQL you need to use tables of the type INNODB with support for foreign keys, reference integrity shall remain. The task: Write a class with the name StudentRegister (means Student registry), the class should use PDO and only prepared statements/questions. The class shall implement the interface StudentInterface, and use the two classes, Student,...