USE MATLAB. Recursion Function Name: runeScape Inputs: 1. (struct) 1x1 structure
ID: 3704737 • Letter: U
Question
USE MATLAB.
Recursion
Function Name: runeScape Inputs: 1. (struct) 1x1 structure representing your character (struct) 1x1 structure representing an item you want to wield 2. Outputs: 1. (char) Sentence describing how much total experience you need to use the item Background Because you're a sensible and reasonable human being, you spend every waking moment playing RuneScape (old school, not RS3). Skilling (rather than killing) is serious business, so you earned a Ph.D in applied mathematics solely to understand the complex equations governing the amount of experience you need to reach the next level. Woodcutting is a skill, so this problem is about trees. In the midst of one of your 14-hour skilling sessions, you come across an item that your character is not high enough level to equip! Upset as you are, you realize that this is a good opportunity to finally put your mathematics training to good use, and you want to write a function that will determine the most efficient way to level your character up so you can wield the item Function Description Write a function to recursively calculate the amount of experience you need to level up in a desired skill. Your character is represented by a 1x1 structure and contains your username (as a string) as well as all your characters' skills as fields. Each skill field contains your character's level in that skill as a double The item you want your character to equip will also be represented by a 1x1 structure. One field, Name, will be the name of the item as a string, and the rest of the fields will be double values representing the skill level requirements for that item characterStruct: itemStruct: Username: : : Name: : : : : ContinuedExplanation / Answer
// MATLAB CODING //
====================
username=input('xXcoolGuy2009Xx');
itemname=input('dragon scimmy');
//input data
CharacterStruct=[54;40;58;1;99];
itemStruct=[60;60];
//amount of experience required to level up calculation
Exp(1,1)=0;
Exp(2,1)=83; //As given in the example for i=3:1:60 Exp(i,1)=(i)^(7/2)+Exp((i-1),1); //As per the formula end //amount of experience required to achieve the attact level of 60 attack=0; for j=55:1:60
attack=Exp(j,1)+attack; end ///amount of experience required to achieve the strength level of 60 Strength=0; for k=41:1:60 Strength=Exp(k,1)+Strength; end //total amount of experience points to use the dragon scimmy required Total=attack+Strength; //to display the result X = sprintf('%s needs %d more experience points to use the %s',username,total,itemname); disp(X)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.