brentwoodhigh.com

| repl.it | w3schools.com | Site Stats
Game | Food Drink | Leave Room | Classroom Tardy | Backpack | Music Cell |
Coding I Schedule | Coding I LogIn | Coding I Archive | Coding I Resources |
Coding II Schedule | Coding II LogIn | Coding II Archive | Coding II Resources |
APP schedule | APP LogIn | APP Archive | APP Resources |
CSF schedule | CSF LogIn | CSF Archive | CSF Resources |

Chapter 3

 

METHODS AND BEHAVIORS

IN THIS CHAPTER, YOU WILL:
Become familiar with the components of a method
Call class methods with and without parameters
Use predefined methods in the Console and Math classes
Write your own value- and nonvalue-returning class methods (with and without parameters)
Distinguish between value, ref, and out parameter types
Explore the use of named and optional parameters with default values
Work through a programming example that illustrates the chapter's concepts

 

METHODS AND BEHAVIORS 131

Anatomy of a Method 132

Anatomy of a Method 132
Modifiers 134
Static Modifiers
Access Modifiers
Return Type 137
Method Name 138
Parameters 138
Method Body 139
IM Questions over Anatomy of a Method

Calling Class Methods141

Calling Class Methods 141
IM Questions over Calling Class Methods

Predefined Methods 143

Write() Method 143
WriteLine() Method 144
Read() Method 145
ReadLine() Method 147
ReadKey() Method 149
Parse() Method 149
Method in the Math Class 151
IM Questions over Predefined Methods

Writing Your Own Class Methods 157

Void Methods 157
Value-Returning Method 159
IM Questions over Writing Your Own Class Methods

Types of Parameters 164

Types of Parameters 164
IM Questions over Types of Parameters

Named and Optional Parameters 169

Default Values with Optional Parameters 170
Named Parameters 171

Coding Standards 180

Naming Conventions 180
Spacing Conventions 180
Declaration Conventions 180
Commenting Conventions 181

Resources 181

Quick Review 181

Exercises 182

Multiple Choice, Completion, and short answer
Essay Questions

Programming Exercises 189

1. School
2. My Name
3. Rectangle
4. Time
5. Fahrenheit to Celsius
6. Meters - Feet
7. Tip
8. Computer Club
9. Take Home Pay
10. Property Tax

 

 

 

 

 

 

 

 

 

 

 

 

 

Updated: Sunday, August 2, 2020 12:17 PM

About Us | Contact Us | ©2005 brentwoodhigh.com