合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

        代寫CS9053、代做Java語(yǔ)言編程

        時(shí)間:2024-02-15  來(lái)源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯(cuò)



        Introduction to Java
        CS**53 Section I2
        Wednesday 6:00 PM – 8:30 PM
        Prof. Dean Christakos
        Feb 8th, 2024
        Due: Feb 15th, 2024 11:59 PM

        Part I – Creating Objects

        1.Square pyramid: In the lecture you have seen the creation of a circle. Here you are going to create a square pyramid. A square pyramid has a square base. It has base, a, and a height, H.




        The Volume of a Pyramid is given by 
        l is known at the “slant” and is given by 
        The surface area of a square pyramid is given by   

        You will create a class SquarePyramid using the following UML:


        In standard UML parlance, “+” indicates that a field or method is public and “-“ indicates that a field or method is private. An underlined field or method indicates it is static.


        Every time you create a new SquarePyramid instance, it should have a new sequential id, based on the value of nextId, which should be incremented every time you create a new SquarePyramid instance.


        2.Objects and Arrays of Objects


        Your objective is to develop the Hero and Party class and to use their methods. The classes are described below to guide you.



        Hero

        The Hero class contains data related to a hero in a video game. Implement the class according to the following UML diagram: 

        Hero

        Data fields
        -name : String
        -role: String
        -level: int
        -experience: int
        -MAX_LEVEL: int

        -ROLES: String[]
            Name of the Hero
        Role of the Hero
        Contains the level of the Hero
        Contains the experience of the Hero
        Constant static int containing the max level of 100.

        The possible roles: “Warrior”, “Priest”, “Wizard”, “Thief” (ie, a static, pre-defined array of Strings)

        Methods
        +Hero (name: String) 


        +setRole(role: String)



        +getters for each non-static field

        +expToLevelUp()
        :int



        +gainExperience(experience: int)
            














        +toString()
            :String    Set the name to given value, set role to “Unassigned”, set level to 1, and experience to 0.

        Set the role of the Hero. If the role is not one of the allowed roles, print “Invalid role” and set the role to “Unassigned”.


        Get the name, role, level, or experience.

        Return the amount of experience necessary to advance to the next level. The formula is level2. For example, at level 6, this should return 62 = 36. This is a helper method for the gainExperience method.

        Increase the experience of the Hero. If the experience reaches or passes the maximum for the Hero’s current level, increase the level by 1 by “consuming” the necessary experience.
        For example, at level 4 with 20 experience, the Hero should level up to 5 with 4 experience remaining. When a Hero levels up, print “<name> is now level <level>!” The max level is 100.

        Note: If enough experience is gained at once, the Hero will level up more than once. For example, a level 3 hero receiving 75 experience will level up to 6 with 
        (75 – 9 – 16 – 25) = 25 experience remaining. 





        Return a String containing the information about the hero: 

        Template:

        “<name> the <role> is level <level> with <experience> experience.”

        Example:

        “Hagrid the Wizard is level 55 with 120 experience.”




        Party

        The Party class contains an array of Hero‘s that are in the party.
        Implement the class according to the following UML diagram:

        Party

        Data fields
        -heroes: Hero[3]
            Array of Hero’s in the current party.

        Methods
        +Party()


        +addHero( hero: Hero, index: int) 



        +removeHero(index: int)


        +getHero(index: int)
            :Hero

        +gainExperience(experience: int)


        +toString()
            :String    Initialize the Hero array to hold 3 Hero’s. Initialize each element to null.

        Add a Hero to the current party at the given index. If there is an existing Hero at the index, replace it. If the hero is already in the party, print “<name> is already in the party.”

        Remove the Hero from the given index (to “remove” from the array, set the array element to null and shift any other elements to the left, so that the only nulls are at the end of the array).

        Return the Hero of the desired index.


        Prints “The party gained <experience> experience.”
        Increase the experience of all the Hero’s in the Party.
        Hint: Use each Hero’s gainExperience method.

        Return a String containing the information about the hero.
        Template:

        “Party:
        <name> the <role> is level <level> with <experience> experience.
        <name> the <role> is level <level> with <experience> experience.
        <name> the <role> is level <level> with <experience> experience.


        Example:

        “Party:
        Thor the Warrior is level 10 with 4 experience.
        Groot the Thief is level 20 with 19 experience.
        Doctor Strange the Wizard is level 5 with 1 experience.“

        Note: Only print assigned party members (Do not print anything if any heroes elements are null).
        Hint: Use each Hero’s toString method.

        After implementing this, create three heroes with names and roles of your choice, add them to the party, and give the party 100 experience points. Then print out the party by calling the toString() method for the party and passing it to System.out.println()
        如有需要,請(qǐng)加QQ:99515681 或WX:codehelp

        掃一掃在手機(jī)打開(kāi)當(dāng)前頁(yè)
      1. 上一篇:代寫CS 476/676 程序
      2. 下一篇:代寫COMP26020、代做Java,c++語(yǔ)言編程
      3. 無(wú)相關(guān)信息
        合肥生活資訊

        合肥圖文信息
        出評(píng) 開(kāi)團(tuán)工具
        出評(píng) 開(kāi)團(tuán)工具
        挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
        挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
        戴納斯帝壁掛爐全國(guó)售后服務(wù)電話24小時(shí)官網(wǎng)400(全國(guó)服務(wù)熱線)
        戴納斯帝壁掛爐全國(guó)售后服務(wù)電話24小時(shí)官網(wǎng)
        菲斯曼壁掛爐全國(guó)統(tǒng)一400售后維修服務(wù)電話24小時(shí)服務(wù)熱線
        菲斯曼壁掛爐全國(guó)統(tǒng)一400售后維修服務(wù)電話2
        美的熱水器售后服務(wù)技術(shù)咨詢電話全國(guó)24小時(shí)客服熱線
        美的熱水器售后服務(wù)技術(shù)咨詢電話全國(guó)24小時(shí)
        海信羅馬假日洗衣機(jī)亮相AWE  復(fù)古美學(xué)與現(xiàn)代科技完美結(jié)合
        海信羅馬假日洗衣機(jī)亮相AWE 復(fù)古美學(xué)與現(xiàn)代
        合肥機(jī)場(chǎng)巴士4號(hào)線
        合肥機(jī)場(chǎng)巴士4號(hào)線
        合肥機(jī)場(chǎng)巴士3號(hào)線
        合肥機(jī)場(chǎng)巴士3號(hào)線
      4. 短信驗(yàn)證碼 酒店vi設(shè)計(jì)

        无码人妻精品内射一二三AV| 99精品在线视频观看| 国产日韩高清三级精品人成| 亚洲国产精品无码久久| 精品日韩亚洲AV无码| 国产精品igao视频网| 中文字幕日韩精品无码内射| 国产精品九九久久免费视频 | 精品乱码久久久久久久| 老司机午夜精品视频资源| 免费精品99久久国产综合精品| 99在线精品视频| 国产精品亚洲综合一区| 午夜成人精品福利网站在线观看| 日韩精品久久久久久| 中美日韩在线网免费毛片视频| 在线观看精品国产福利片尤物| 国产精品99久久不卡| 人妻无码久久精品人妻| 亚洲AV成人精品日韩一区| 亚洲综合精品伊人久久| 久久夜色精品国产噜噜亚洲a| 国产成人精品免费视| 中文字幕日韩精品麻豆系列| 1313午夜精品理伦片| 久久99国产综合精品免费| 亚洲国产精品不卡在线电影| 久久国产精品久久精| 无码精品人妻一区二区三区人妻斩 | 欧美日韩精品一区二区在线视频 | 精品无码一区二区三区水蜜桃| 日韩毛片免费无码无毒视频观看| 2015日韩永久免费视频播放| 中文字幕日韩精品一区二区三区| 日韩精品真人荷官无码| 日韩视频在线精品视频免费观看| 亚洲av日韩av高潮潮喷无码| 亚洲欧美日韩中文无线码 | 香蕉久久夜色精品升级完成| 久久久久久国产精品三级| 漂亮人妻被黑人久久精品|