Reference no: EM133172769
ADS103 Algorithms and Data Structures
Assessment - Programming Assignment
Learning Outcome 1: Identify and utilise data structures appropriately to solve software engineering problems.
Learning Outcome 2: Apply fundamental object-oriented programming concepts to demonstrate understanding.
Learning Outcome 3: Design and develop functions and classes to manage levels of code complexity.
Learning Outcome 4: Demonstrate the ability to read and interpret moderately complex code, describe its purpose, and systematically debug for issues in syntax or logic.
Assessment Task
Implement the inheritance and linked list tasks below to demonstrate your understanding of object- oriented programming and memory allocation.
Please refer to the Task Instructions for details on how to complete this task.
Context
This assessment focuses on the use of classes and inheritance to solve software design problems, requiring you to grow and demonstrate your understanding of object-oriented programming (OOP) fundamentals. Inheritance is a powerful way to modularise your code, further allowing for easy testing and reuse.
Further, you will apply your knowledge of the concepts and management of data and memory to the building of a linked list, a key data structure used as a base for many containers in use today.
These are fundamental skills required by the software engineering industry.
Instructions
To complete this assessment task, you must build solutions to the two problem tasks. Ensure that:
• Code is well documented with comments
• Class, function, and variable names follow the naming conventions set by the learning facilitator
• Code is indented and broken down into smaller functions and files where it will improve clarity and improve testing
• Any third-party code should be appropriately attributed to the creator or original source
Task 1: Classes and Inheritance
This first program will simulate a battle between Role Playing Game (RPG) characters. You'll need to make classes to represent the different kinds of characters, and those classes will inherit common features from a base class, reducing redundance.
Step 1
Build a base class called Character and two subclasses called Warrior and Mage inheriting from Character class.
Further extend the inheritance tree by building a class called Paladin, inheriting from
Warrior class.
Step 2
Below is a list of attributes(variables) you're going to need for the characters. You'll need to decide which classes they should be in, at which levels of the inheritance tree above. Keep in mind that common attributes to all classes should be inherited where possible. These attributes are private, so the appropriate getter and setter methods should be implemented.
Attributes: name, hitPoints, manaPoints, strength, defence, ragePoints, fireballDamage, healAmount
Step 3
The following methods should be callable on objects of all your classes:
DoAction(): Returns an int of how much damage the action does. Output what action is taking place to the user
TakeDamage(int dmg): Subract defence from the damage and subtract the result from hitPoints. You should always do at least 1 point of damage. Output remaining hitPoints at the end of the method
IsAlive(): Returns true if hitPoints are greater than zero
Warrior should override the DoAction method to follow this logic:
If ragePoints greater than 15
spend 15 ragePoints to do HeavySwing and return the damage from that attack
else
Add 5 ragePoints to total Return strength (default attack damage)
Warrior's heavySwing method should do more damage than their strength alone, multiplying it by some value (2x, 3x, etc.-you may decide based on balancing)
Mage should also override the DoAction method to follow this logic:
Paladin should also override the DoAction method and decide to Heal using ragePoints if
hitPoints are low. Note: healing Paladin should return zero damage from the DoAction method.
Step 4
Each class should have a constructor method to set their attributes to default values. Add any other additional methods you need.
Step 5
In the main function of the program, instantiate Paladin and Mage objects and, using a while loop, get them to battle until one of them is no longer alive. Make them hit each other like so:
Int paladinDamage = paladin.DoAction();
mage.TakeDamage(paladinDamage);
Task 2: Linked List
Write your own custom LinkedList class and a program to create and run a variety of performance tests on LinkedList objects.
Define class Node that holds a data of type int and has a pointer to next Node.
Define class LinkedList to help organise Nodes into a singly LinkedList data structure.
Write a program that instantiates two LinkedList objects, linkedList1 and linkedList2.
Using a time library (include chrono or other), measure how long it takes to insert 50,000 random numbers into linkedList1 at the beginning of its structure in milliseconds.
Measure how long it takes to insert 50,000 numbers onto the back of linkedList2 in milliseconds.
Compare, in code, the time taken inserting into each list (steps 2.4, 2.5) and output a message to the console stating which approach was more efficient.
Delete all Nodes starting from the front of linkedList1.
Delete all Nodes in linkedList2 starting from the back.
Compare, in code, the time taken deleting the contents of each list (steps 2.7, 2.8) and output a message to the console stating which approach was more efficient.
Referencing
It is essential that you use appropriate APA style for citing and referencing research.
Attachment:- Algorithms and Data Structures.rar