--- title: "Jam 02 - All" tags: - 3 🧪 in testing - 4 🥳 done - jam02 - methods - objects - recursion - performance --- <!-- markdownlint-disable line-length single-h1 no-inline-html --> <!-- markdownlint-configure-file { "ul-indent": { "indent": 4 }, "link-fragments": {"ignore_case": true} } --> # Jam 02 - Methods {%hackmd dJZ5TulxSDKme-3fSY4Lbw %} :::spoiler **Course Development Team** <center> <table width="100%"> <tr align="center"> <td width="50%"> <img src="https://www.dropbox.com/scl/fi/uz9dn7vc9y5k43160pdb0/Fun-Artsy-Square.png?rlkey=2zmgqgblwsagukfsb343tl3ye&raw=1" alt="Lily Romano" width="100" style="border-radius: 50%"/><br/> <a href="https://lilyromano.com">Lily Romano</a> </td> <td width="50%"> <img src="https://www.bucknell.edu/sites/default/files/styles/faculty_page_photo/public/libris/C00001GOQFVeT0YE/G0000hRJySpIobZY/20160419-7C8A4469.jpg" alt="Brian King" width="100" style="border-radius: 50%"/><br/> <a href="https://www.bucknell.edu/fac-staff/brian-king">Brian King</a> </td> </tr> </table> </center> ::: | | | | ---------------------- | ---------------------------------------- | | **Working Directory:** | `src/main/java/jam02` | | **Points:** | 10 pts | | **Team-based?** | NO (but discussion encouraged) | | **Due:** | Monday, 2025-Feb-06 @ 11:59 pm | # Objectives - Master Java's type system, including primitive types and their wrapper classes - Create and work with Java classes, including constructors and instance methods - Understand how different implementation choices affect performance - Explore recursive and iterative algorithm implementations - Practice working with Java's BigInteger class for arbitrary-precision arithmetic # Introduction & Outcomes This jam will help you transition from Python to Java by exploring fundamental differences in how these languages handle types and objects. You'll create several programs that demonstrate these differences, while learning how your design and implementation choices can significantly impact performance. Through hands-on exercises with dice simulation and number sequences, you'll gain practical experience with Java classes, methods, and performance measurement. ## What You'll Learn & Accomplish 1. **Java Types & Objects** - **Outcome**: Understand the difference between primitive types and objects in Java - **Outcome**: Master the use of wrapper classes and auto-boxing/unboxing - **Outcome**: Create a complete Java class with constructors, methods, and proper encapsulation 2. **Performance & Implementation Choices** - **Outcome**: Measure and analyze performance differences between implementation approaches - **Outcome**: Compare recursive vs iterative solutions for algorithm implementation - **Outcome**: Use BigInteger to handle arbitrary-precision calculations 3. **Practical Programming Skills** - **Outcome**: Create a simulation using random number generation - **Outcome**: Implement proper input validation and error handling - **Outcome**: Format output for clear data presentation <!-- Embeds Jam02-Checklist.md --> {%hackmd q-RCaT2SRcW64j7hYq1anQ %} # Getting Started Before diving into the exercises, let's set up our workspace: 1. Open IntelliJ 2. Create a directory `jam02` under `src/main/java` 3. Create a new file called `answers.txt` in your `jam02` directory <!-- Embeds Jam02-Exercise1.md --> {%hackmd yUwn_gVmQW-NEvpqnT1QZw %} <!-- Embeds Jam02-Exercise1.5.md --> {%hackmd jWsPyo0ETA2cWKHWzf2n0g %} <!-- Embeds Jam02-Exercise2.md --> {%hackmd UZrs0J78TBi_suhVnNFPpw %} <!-- Embeds Jam02-Exercise3.md --> {%hackmd 2OtpEcxWTByAdk1oJ8vnaQ %} <!-- Embeds Jam02-Exercise4.md --> {%hackmd V7qpdAQaSvenCAKu41Tm-w %} <!-- Embeds Jam02-Exercise5.md --> {%hackmd hIjNBxWqRYG61v7mW-Q4oA %} <!-- Embeds Jam02-Submission.md --> {%hackmd u4IZXZewTj2lBzyE0KGdRw %}