Assignment 1 Players Game Cards Management System1 Overviewthis Ass ✓ Solved
Assignment 1: Player’s Game Cards Management System 1. Overview This assignment aims to establish a basic familiarity with the JDK development system and its associated on-line Java API class documentation. Students should apply the appropriate fundamental programming concepts (such as variables, constants, arrays, strings, methods, selection and repetition constructs etc.) and make use of appropriate Java API classes (such as Scanner, PrintWriter, String etc.) that they have learnt to solve the given problem. 2. Objectives On completion of this assignment a student should be able to write simple Java application that: • Makes use of selection and repetition constructs to achieve desired outcomes • Stores data to and reads data from arrays • Generates output to and reads input from the console window • Reads data from and writes data to text file • Manipulates string using Java API "String" class • Handles basic errors • Applies object-oriented concepts 3.
Scope This assignment is based on individual effort. You are required to design, develop and test a Player’s Game Cards management system for a game application. Besides providing the required functionalities, your program should incorporate appropriate error handling. Comments are also to be inserted to improve program clarity. Before you start coding your program, you are strongly advised to carry out proper problem analysis and program design.
You are required to use JDK 1.5 developer version or later. 4. Requirements This application allows the admin to 1. Admin login 1. Select Player to manage 1.
Manage a Player game card 2. Create a game card 2. Delete a game card 2. Edit a game card information 2. Search and display game cards information 2.
Back to previous menu 1. Change admin password 1. Logout This application will have access to the following text files. The first text file (Admin.dat) contains the administrator-hashed password (SHA-256). For example 688787d8ff144c502c7f5cffaafe2cc588d86079f9de88304c26b0cb99ce91c6 The second text file (Players.dat) contains all the Player’s nickname in the following format <Nickname>|<Hash Password> For example Ash|0b14d501a594442a01cbcb3e8164d183d32937bf69d5c94e Misty|6cf615d5bcaac778352a8f1f3360d23f02f34ec182e259897fd6ce485d7870d4 Brock|5906ac361a137e2d286465cd6588ebb5ac3f5aebc41577c3d751764 Each Player will have a data file with the information of all their game cards in the following format <Name>|Punch Energy>|<Fireball Energy>|<Kick Energy> For example Ash.dat Pikachu|30|15|40 Absol|20|50|15 Catepile|55|25|15 Zubat|20|10|10 For example Misty.dat Bulbasaur|10|25|20 Pidgeot|20|20|30 Rattata|30|5|60 Raichu|5|15|10 Error Handling Your program should be able to handle error situations.
For example where a game card name already existed (for Create a game card) or game card name not found (for delete game card). You should look out for other possible exceptions and handle them too. Testing requirements Make sure that you are able to compile and run your program using the command ( javac AdminModule.java and java AdminModule ) directly from the command prompt from the project folder. Set the default admin password to “asdâ€. In the Players.dat, you should have the following three Player’s data.
Player nick name Password Ash password1 Misty password2 Brock password3 (Remember to hash the players’ password) Each player will have a dat file with at least 4 game cards. For example Ash.dat Pikachu|30|15|40 Absol|20|50|15 Catepile|55|25|15 Zubat|20|10|10 For example Misty.dat Bulbasaur|10|25|20 Pidgeot|20|20|30 Rattata|30|5|60 Raichu|5|15|10 Make up the other player’s game cards information. 5. Submission A complete submission requires the following items: Program in Zip file for execution (see below) Missing in any of the above items is consider non-submission. Late submission for any above items is consider late submission Zip file instruction Go to the Eclipse workspace folder, locate your project folder and then the src folder.
Copy all the dat files into the src folder (or the appropriate subfolders). Make sure that you are able to compile and run your program using the command ( javac AdminModule.java and java AdminModule ) directly from the command prompt from the project src folder. 1, For your first assignment, you will be practicing using PowerPoint to present research on Careers in CS/CIS and steps to get there. Think of a career path, or specific Computer Science / Computer Information Systems career that you are interested in, and present a PowerPoint on that subject. You will give information as to the current demands for that career, income, growth potential, and what educational path it would take to get there.
2, Watch the following YouTube video. List five items that were changed and your reaction to how easy it was to make these changes. 3,When someone mentions photo editing, you're likely to have Photoshop, GIMP, or Paintshop Pro come into your mind. If you've had a computer long enough, you might even think of MS Paint. Photo editing is big business, and used everywhere from newspapers and magazines, to websites and printing.
Because good photo editing software is expensive, many people search the Web for free tools. One of those tools is called Pixlr, and it has many powerful tools that you will find in expensive photo editing applications. Today we will use Pixlr to edit a photo by merging two photos together to create something new. You will begin by selecting two images from Google Images, downloading them, and importing them into Pixlr. There are two videos below this assignment.
Video Tutorial #1 - Shows you how to use Google to find an image, and load it into Pixlr using the image's URL (web address). Although this tutorial shows you how to import a small image, you can use it to choose a background for your image before you begin the Video Tutorial #2. Video Tutorial #2 - Shows you how to overlay one image onto another one. When you have finished creating your image, click on the File tab, choose Save As, and make sure you choose Computer so you can save your file to your computer for submission to the assignment. 4(follow the no.2 question),Now that you have installed Microsoft Office, and have been submitting assignments using Microsoft Word or Google Docs we will expand on your skills.
In this assignment, we will use APA formatting to submit a college level paper. You will use your writing from the Photo Forensics assignment in module one to reformat as an APA paper. APA is the format used in technology, science, and psychology writing. Using correct formatting may look daunting, but it's more simple than you'd think. Here is a link to a 4 minute video that will make all of your future APA writing simple.
Microsoft Word 2016 has APA tools built in. Check it out.
Paper for above instructions
Overview
The Player's Game Cards Management System serves as a foundational Java application designed to manage player game cards for a gaming application. This application allows an administrator to authenticate and manage player data, including creating, deleting, editing, and searching game cards, while ensuring data integrity and providing a user-friendly experience.
Objectives
Upon completion of this project, the developer should have a robust understanding of:
- Using selection and repetition constructs in Java.
- Managing data using arrays.
- Generating input from the console and writing output accordingly.
- Reading data from and writing to text files.
- Manipulating strings using Java’s String class.
- Implementing basic error handling within the application.
- Applying object-oriented programming concepts effectively in Java.
System Functionalities
The system will provide the following functionalities:
1. Admin Login: Secure login for the administrator.
2. Player Management:
- Select the player to manage.
- Create a game card.
- Delete a game card.
- Edit game card information.
- Search and display game card information.
- Change the admin password.
3. Logout: Securely logs the admin out of the system.
Data Management
The application requires the handling of the following data files:
- Admin.dat: Stores the admin's hashed password using SHA-256.
- Players.dat: Contains player nicknames and their associated hashed passwords.
- Individual Player Data Files: Each player will have their game cards stored in a specific format indicating the card name and its respective energies.
Error Handling
Robust error handling measures will be put in place to ensure seamless user interaction. Examples of potential errors include:
- Attempting to create a game card that already exists.
- Attempting to delete a game card that does not exist.
- Handling I/O exceptions that may occur during file operations.
Implementation
Here’s a basic structure of the AdminModule.java and how different functionalities will be implemented:
Code Implementation
```java
import java.io.*;
import java.nio.file.*;
import java.security.MessageDigest;
import java.util.*;
public class AdminModule {
private static final String ADMIN_FILE = "Admin.dat";
private static final String PLAYERS_FILE = "Players.dat";
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String adminPassword = readAdminPassword();
boolean loggedIn = false;
// Admin login
while (!loggedIn) {
System.out.print("Enter admin password: ");
String inputPassword = scanner.nextLine();
if (hashPassword(inputPassword).equals(adminPassword)) {
System.out.println("Login Successful!");
loggedIn = true;
adminMenu(scanner);
} else {
System.out.println("Invalid password.");
}
}
scanner.close();
}
private static void adminMenu(Scanner scanner) {
boolean running = true;
while (running) {
System.out.println("1. Manage Player");
System.out.println("2. Change Admin Password");
System.out.println("3. Logout");
System.out.print("Choose an option: ");
int option = Integer.parseInt(scanner.nextLine());
switch (option) {
case 1:
managePlayer(scanner);
break;
case 2:
changeAdminPassword(scanner);
break;
case 3:
running = false;
break;
default:
System.out.println("Invalid choice.");
break;
}
}
}
private static void managePlayer(Scanner scanner) {
// Logic to manage player game cards
}
private static void changeAdminPassword(Scanner scanner) {
// Logic to change admin password
}
private static String readAdminPassword() {
try {
return new String(Files.readAllBytes(Paths.get(ADMIN_FILE))).trim();
} catch (IOException e) {
System.out.println("Error reading admin password file.");
}
return null;
}
private static String hashPassword(String password) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hash = digest.digest(password.getBytes(StandardCharsets.UTF_8));
StringBuilder hexString = new StringBuilder();
for (byte b : hash) {
String hex = Integer.toHexString(0xff & b);
if (hex.length() == 1) hexString.append('0');
hexString.append(hex);
}
return hexString.toString();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
```
Explanation of Code Structure
1. Admin Login: The initial functionality checks if the entered password matches the hashed password stored in Admin.dat. If successful, it presents the admin menu to the user.
2. Admin Menu: The menu allows the admin to choose what action they wish to take – managing players or changing the password.
3. Manage Player: A method stub for managing player entries, including adding, removing, and editing game cards.
4. Change Password: The functionality for changing the administrator's password, which would also involve hashing the new password and saving it.
Future Enhancements
- Unit Testing: Implementing JUnit tests to ensure the reliability of methods.
- Graphical User Interface (GUI): Moving from console-based interactions to a GUI for better user experience.
- Database Integration: Transitioning from flat-file storage to a more robust database system to handle larger data sets efficiently.
Conclusion
Developing the Player’s Game Cards Management System affords a comprehensive experience in object-oriented programming and effective file handling in Java. By applying fundamental concepts such as arrays, strings, and error management, the system offers a functional advantage for game administrators. This assignment not only demonstrates technical capabilities but also serves as a stepping stone to more advanced programming challenges in software development.
References
1. Bloch, J. (2018). Effective Java. Addison-Wesley.
2. Java Development Kit. (2023). Oracle. Retrieved from https://www.oracle.com/java/technologies/javase-jdk11-downloads.html
3. Hashing in Java. (2023). Baeldung. Retrieved from https://www.baeldung.com/java-hashing
4. Data Input and Output Streams. (2023). Oracle. Retrieved from https://docs.oracle.com/javase/tutorial/essential/io/index.html
5. Java String Handling. (2023). GeeksforGeeks. Retrieved from https://www.geeksforgeeks.org/java-string-handling/
6. Java Exceptions Handling. (2023). Oracle. Retrieved from https://docs.oracle.com/javase/tutorial/essential/exceptions/index.html
7. Scanner Class in Java. (2023). TutorialsPoint. Retrieved from https://www.tutorialspoint.com/java/java_basic_io.htm
8. File Handling in Java. (2023). Javatpoint. Retrieved from https://www.javatpoint.com/file-handling-in-java
9. Object-Oriented Programming Concepts. (2023). JavaTpoint. Retrieved from https://www.javatpoint.com/java-oops-concepts
10. Introduction to Data Structures. (2023). GeeksforGeeks. Retrieved from https://www.geeksforgeeks.org/data-structures/
This assignment showcases the importance of understanding programming fundamentals, algorithm design, and effective file management, preparing you for real-world software development tasks.