• Home
  • DMP
    • DMP Calendar
    • DMP Notes >
      • Media Literacy >
        • Media Ownership
        • Digtial Manipulation
        • Intro to Media Quiz
      • Audio >
        • This American Life
        • Audio Exercises
        • Foleys
      • Storytelling
      • Capturing Video
      • Deconstructions >
        • Magazine Deconstruction
    • DMP Resources
  • 3D Animation
    • 3D Animation Calendar
    • 3D Modeling >
      • Blender Basics >
        • Donut Tutorial
        • Modifiers
        • Sculpting
      • Modeling Tutorials
    • 3D Printing
    • Adv 3d Modeling >
      • Surfaces >
        • Materials
        • Nodes
        • Textures
    • 3D Modeling & Animation Resources
  • Web Design
    • Web Design Calendar
    • Notes >
      • Organization and Planning >
        • Basic Computer Terms
        • Critiquing Web Pages
        • Parts of URL
        • Webmasters & Accessibility
        • File Structure
        • Naming Conventions
        • Web Page Layouts
        • Good Websites
        • Organization & Planning Quiz
      • Setting up a Page >
        • HTML Basics >
          • Code Basics >
            • HR and special char
            • Lists >
              • Basic Lists
              • List Formats
            • HR & Formatting Exercise
            • Headings, PG & Lists Exercise
            • Invitation Assignment
      • Advanced HTML >
        • Tables >
          • Basic Tables
          • Table Exericses 1
          • Advanced Tables
          • Table Exercise 2
        • Color >
          • Color Design
          • Color Exercise
        • Links >
          • Absolute links
          • Relative Links
          • Email Links
          • Named Anchors
          • Links Exercise 2
        • Images >
          • Adding Images
          • Image Mapping
          • Colors & Tables Exercise
        • CSS >
          • About CSS
          • Styles >
            • Inline CSS
            • Embedded Styles
            • External Styles
          • Style Attributes >
            • CSS Text Styles
            • CSS Backgrounds
            • Link Styles
          • Selectors
          • Classes & IDs
          • Div vs Span
          • CSS Hierarchy
          • The Box Model
          • CSS Practice Project 1
          • Transparency
          • CSS Positioning
          • CSS Transform
          • CSS Practice Project 3
      • JavaScript >
        • JavaScript Examples
    • Independent Project
    • Web Design Resources
  • Com Art
    • Com Art Calendar
    • What is Graphic Design? >
      • Black Square Problem
    • History of Design >
      • History of Design Review
      • History of Design Quiz
    • Elements & Principles >
      • Line
      • Shape
      • Form
      • Texture
      • Color
      • Value
      • Space
      • Principles of Design
      • Elements/Principles Review
      • Elements & Principles Quiz
    • Design Process >
      • 99 Thumbnails
      • Road Sign Problem
      • Life And Death Problem
      • Face Mask Design
    • Computer Graphics >
      • Photoshop Filters Project
      • Photoshop Fill Project
      • Photoshop Self Portrait
      • Contrasting Images Project
      • Phrase Blending Project
      • Photoshop Tips & Tricks
    • Com Art Resources
  • General Info
    • Sign Out Form
    • Adding Calendar Info
    • About Google Drive
    • Creating/Sharing a Drive Folder
    • How to join Remind
    • Make Everything Okay
HERMANET THE G.O.A.T.

Writing Classes

In this unit, you will create your own classes with methods to perform required operations. Complicated methods will be divided into simpler, supporting methods. Some methods will be overloaded and become polymorphic.
Objectives
  • Define classes that act like blueprints for new objects, made of variables and methods.
  • Explain encapsulation and Java modifiers.
  • Explore the details of method declarations.
  • Review method invocation and parameter passing.
  • Explain and use method overloading.
  • Learn to divide complicated methods into simpler, supporting methods.
  • Describe relationships between objects.
Writing Classes PowerPoint Notes (Part 1)
​Writing Classes PowerPoint Notes (Part 2)
​Writing Classes PowerPoint Notes (Part 3)
Writing Classes Practice Page
Writing Classes Practice Page Answers


Writing Classes Assignment Packet
Example Source Files (What do these programs do & how do they work?):
CountFlips.java
Coin.java
Account.java
ManageAccounts.java
Die class
​Classes And Objects Notes Page
Writing Classes Headings Guide
UML Diagram Structure Notes

About Class Structures
Picture
Picture
Notice that the name or value of the actual parameter takes on the name of the formal parameter when it is used within the method body. In this generic example, any variables or data put in the method call would take on the name "variableName" in the method when it is used. It's the same value but has a different identifier.

Here's an actual example:
Picture
As you can see, the actual parameter of 6 is assigned to the formal parameter "userInput" and then used in the method when it is run. When complete, the variable y would have a value of 18.

Note that the variable "userInput" can only be used within the method "multiplyValue" because it has limited SCOPE. If you need a variable to be used throughout the program, you need to create it with GLOBAL SCOPE by declaring it outside the method.
The diagram below shows the parts of an example method:
In a method, the return type listed in the method header MUST MATCH the return type specified in the body of the method. Also, if a return type is listed in the header, there must be a return statement in the body. Conversely, you cannot put a return statement in the method body if no return type is listed in the header. Finally, if you don't want a return type, you must put the word "void" as the return type in the method header.
Picture

​

Powered by Create your own unique website with customizable templates.