https://github.com/redinfinitypro/lab-6
The `Fighter` class extends the `Player` class by adding new attributes such as `sword` and `armor`, while also utilizing inherited attributes. It includes methods for displaying player data and calculating damage and defense. The `Main` class employs `PlayerReader` to load player data from "players.txt" to create objects.
https://github.com/redinfinitypro/lab-6
arraylist bufferedreader filereader ioexception java
Last synced: 4 months ago
JSON representation
The `Fighter` class extends the `Player` class by adding new attributes such as `sword` and `armor`, while also utilizing inherited attributes. It includes methods for displaying player data and calculating damage and defense. The `Main` class employs `PlayerReader` to load player data from "players.txt" to create objects.
- Host: GitHub
- URL: https://github.com/redinfinitypro/lab-6
- Owner: RedInfinityPro
- Created: 2025-09-28T21:35:44.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2025-10-03T03:39:13.000Z (4 months ago)
- Last Synced: 2025-10-03T05:39:31.764Z (4 months ago)
- Topics: arraylist, bufferedreader, filereader, ioexception, java
- Language: Java
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Lab-6

## Packages
The `Fighter` class, which extends the `Player` class, adds attributes like `sword` and `armor`, initializing them through its constructor along with inherited attributes. It includes methods for printing player information and calculating damage and defense based on specific formulas. The `Main` class utilizes `PlayerReader` to load player data from "players.txt", instantiating player objects and printing their details. The abstract `Player` class contains essential attributes and methods for all players, mandating subclasses to implement certain functionalities. Subclasses like `Priest`, `Rogue`, and `Wizard` add unique attributes and override damage and defense calculation methods, tailoring them to each character's specifications. The code handles file reading and error management effectively, ensuring robust player data management.
# Table of Comtents
- Description
- Project Structure
# Description
The `Fighter` class, an extension of the `Player` class, adds `sword` and `armor` attributes, with methods for calculating damage and defense based on these and the player's strength. The `printPlayer` method displays player details including type and attributes, while `getType` returns "Fighter." The `Main` class retrieves player data from "players.txt" using `PlayerReader`, which processes different player types, creating instances from the file data and initializing their attributes. Other subclasses include `Priest`, `Rogue`, and `Wizard`, each with unique attributes and overridden methods for displaying details and calculating their specific damage and defense requirements based on class characteristics. The implementation ensures adherence to abstract methods defined in the `Player` class for consistency across player types.
# Project Structure
📄 Fighter.class
📄 Fighter.java
📄 Main.java
📄 Main.class
📄 Player.class
📄 Player.java
📄 PlayerReader.class
📄 PlayerReader.java
📄 Priest.class
📄 Priest.java
📄 Rogue.java
📄 Rogue.class
📄 Wizared.class
📄 Wizared.java
📄 players.txt