[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-199566-en":3,"doc-seo-199566-105":29,"detail-sidebar-cat-0-en-105":88},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":20,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":20,"language":21,"language_code":22,"site_id":23,"html_lang":22,"table_of_contents":24,"faqs":25,"seo_title":26,"seo_description":14,"update_tm":27,"read_time":28},199566,34359740700684,"Finn","https://ap-avatar.wpscdn.com/avatar/1f400023980c374ae676?_k=1777273430885731487",4,"Exam","Java Review/Practice - Designing a Simple Game Character Class","Java review and practice task focused on designing a simple DDChar class for a Dungeons and Dragons–style game. The assignment specifies immutable String and int properties set in constructors, mutable float properties with getter/setter methods, and required class behaviors including strengthen(float percent) with bounds to prevent negative strength, a toString method for current state output, and an equals method based on object identity/pointer equality. Includes stepwise development and in-class solution walkthrough.","Cmp Sci 187: Programming with Data Structures  \nDiscussion section: Java Review/Practice: Designing a Simple Game Character Class  \nYour task is to write portions of a class DDChar that models a character from a “Dungeons and Dragons”style game. While full characters in such games can be quite complex, we will model only some simple properties for now:  \n• Some String values, that once set (in the constructor) cannot be changed: name, hair color  \n• Some int values, that once set (in the constructor) cannot be changed: height, weight  \n• Some float values, that can change, but may be set in a constructor: strength, dexterity  \nEach of the properties needs a get method. The ones that can change need a set method. We also desire the following methods:  \n• A strengthen method, which takes a float percent and adjusts the character’s current strength by hat amount, e.g., if d is a DDChar, then d.strengthen(5.0) increases the strength by 5%(multiplies by 1.05) and d.strengthen(-1.0) weakens d’s strength by 1%(multiplies by.99) . It should not allow the strength to become negative.  \n• A toString method, for printing out the current state of a DDChar.  \n• An equals method, for seeing if two DDChar objects are the same (pointer equality is appropriate in this case) .  \n1. Write a skeleton of the class, with the class declaration line, field declaration lines, and two constructors and methods with empty bodies. You may use another sheet of paper, or the back of this one.  \n2. Once we’ve completed 1 together, I will hand out a possible skeleton. You are to fill in the bodies of the methods in turn, and I will present and go over a possible solution for each.  \n3. We’ll rate the value of this exercise to you with a simple in-class raise-your-hand voting scheme.","cbCaisrMToVAU0Ij","https://ap.wps.com/l/cbCaisrMToVAU0Ij","pdf",22396,1,"English","en",105,"# Java Review/Practice\n## Designing a Simple Game Character Class\n## Class Requirements\n## Implementation Steps\n## In-Class Rating","[{\"question\":\"Which DDChar properties are immutable after construction, and how are they handled?\",\"answer\":\"The name and hair color (String) and the height and weight (int) are set in the constructors and cannot be changed afterward.\"},{\"question\":\"How should the strengthen(float percent) method update strength?\",\"answer\":\"strengthen multiplies the current strength by 1 + percent/100 (e.g., +5% → 1.05, -1% → 0.99), and it must prevent strength from becoming negative.\"},{\"question\":\"What methods are required for output and equality, and what should equals() compare?\",\"answer\":\"A toString method prints the current DDChar state, and an equals method checks whether two DDChar objects are the same; pointer equality is appropriate.\"}]","Java Review/Practice - Designing a Simple Game Character Class | PDF",1788506355,3,{"code":4,"msg":30,"data":31},"ok",{"site_id":23,"language":22,"slug":32,"title":13,"keywords":33,"description":14,"schema_data":34,"social_meta":83,"head_meta":85,"extra_data":87,"updated_unix":27},"java-reviewpractice-designing-a-simple-game-character-class","",{"@graph":35,"@context":82},[36,51,65],{"@type":37,"itemListElement":38},"BreadcrumbList",[39,43,47,49],{"item":40,"name":41,"@type":42,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":44,"name":45,"@type":42,"position":46},"https://docshare.wps.com/document/","Document",2,{"item":48,"name":12,"@type":42,"position":28},"https://docshare.wps.com/document/exam/",{"item":50,"name":13,"@type":42,"position":11},"https://docshare.wps.com/document/java-reviewpractice-designing-a-simple-game-character-class/199566/",{"url":50,"name":13,"@type":52,"author":53,"headline":13,"publisher":55,"fileFormat":58,"inLanguage":22,"description":14,"dateModified":59,"datePublished":59,"encodingFormat":58,"isAccessibleForFree":60,"interactionStatistic":61},"DigitalDocument",{"name":9,"@type":54},"Person",{"url":40,"name":56,"@type":57},"DocShare","Organization","application/pdf","2026-09-04",true,{"@type":62,"interactionType":63,"userInteractionCount":20},"InteractionCounter",{"@type":64},"ViewAction",{"@type":66,"mainEntity":67},"FAQPage",[68,74,78],{"name":69,"@type":70,"acceptedAnswer":71},"Which DDChar properties are immutable after construction, and how are they handled?","Question",{"text":72,"@type":73},"The name and hair color (String) and the height and weight (int) are set in the constructors and cannot be changed afterward.","Answer",{"name":75,"@type":70,"acceptedAnswer":76},"How should the strengthen(float percent) method update strength?",{"text":77,"@type":73},"strengthen multiplies the current strength by 1 + percent/100 (e.g., +5% → 1.05, -1% → 0.99), and it must prevent strength from becoming negative.",{"name":79,"@type":70,"acceptedAnswer":80},"What methods are required for output and equality, and what should equals() compare?",{"text":81,"@type":73},"A toString method prints the current DDChar state, and an equals method checks whether two DDChar objects are the same; pointer equality is appropriate.","https://schema.org",{"og:url":50,"og:type":84,"og:title":13,"og:site_name":56,"og:description":14},"article",{"robots":86,"canonical":50},"index,follow",{"doc_id":7,"site_id":23},{"code":4,"msg":5,"data":89},[90,94,98,101,106,111,116,121,126,129,133],{"id":20,"doc_module":4,"doc_module_name":45,"category_name":91,"show_sort_weight":92,"slug":93},"Story & Novel",90,"story-novel",{"id":46,"doc_module":4,"doc_module_name":45,"category_name":95,"show_sort_weight":96,"slug":97},"Literature",80,"literature",{"id":11,"doc_module":4,"doc_module_name":45,"category_name":12,"show_sort_weight":99,"slug":100},70,"exam",{"id":102,"doc_module":4,"doc_module_name":45,"category_name":103,"show_sort_weight":104,"slug":105},5,"Comic",60,"comic",{"id":107,"doc_module":4,"doc_module_name":45,"category_name":108,"show_sort_weight":109,"slug":110},6,"Technology",50,"technology",{"id":112,"doc_module":4,"doc_module_name":45,"category_name":113,"show_sort_weight":114,"slug":115},7,"Healthcare",40,"healthcare",{"id":117,"doc_module":4,"doc_module_name":45,"category_name":118,"show_sort_weight":119,"slug":120},8,"Research & Report",30,"research-report",{"id":122,"doc_module":4,"doc_module_name":45,"category_name":123,"show_sort_weight":124,"slug":125},9,"Religion & Spirituality",20,"religion-spirituality",{"id":124,"doc_module":4,"doc_module_name":45,"category_name":127,"show_sort_weight":124,"slug":128},"World Cup","world-cup",{"id":130,"doc_module":4,"doc_module_name":45,"category_name":131,"show_sort_weight":130,"slug":132},10,"Lifestyle","lifestyle",{"id":134,"doc_module":4,"doc_module_name":45,"category_name":135,"show_sort_weight":102,"slug":136},19,"General","general"]