Objects, methods, and classes

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Identify the (a) class, (b) object, and (c) type of parameters passed to the constructor: "BankAccount account39 = new BankAccount(500.43);"

(a) BankAccount (b) account39 (c) double

Identify the (a) class, (b) object, and (c) type of parameter(s) passed to the constructor: " double length = 44.0; int width = 13; Rectangle myRect = new Rectangle(length,width); "

(a) Rectangle (b) myRect (c) double and int

System.out.println(rand.nextInt(50)+1);

1...50

System.out.println(rand.nextInt(90)+10);

10...99

System.out.println(rand.nextInt(120)+60);

60...179

Print two lines of Java code that will create a Bank object for yourself and initialize both your checking and your savings account to $1 million.

Bank myAccount; myAccount = new Bank(10000000,1000000);

abs, sqrt, pow, round, floor, ceil, min, max

Math class methods

_____ _______ is when a method can have the same name but different parameters.

Method overloading

In a Computer Graphics Coordinate system X-values increase moving _____ and Y-values increase moving _____.

X-values increase moving right; Y-values increase moving down

In a Cartesian Coordinate system X-values increase moving _____ and Y-values increase moving ______.

X-values increase moving right; Y-values increase moving up

A collection of some category

a class

To call a(n) _____ method one uses the class identifier, followed by a period and the method identifier.

class

In the statement "import java.util.Random;" what is the class and what is the package?

class - Random; package - util

Math methods are _____ methods.

class methods

One ____, many ______.

class; objects

Data and methods are contained in what?

classes

What are the 4 stages of program design?

cryptic programming stage, spaghetti programming stage, structured programming, object-oriented programming

The state of attributes and methods being packaged in the same container, same object, or same capsule is called what?

encapsulation

Object-oriented programming incorporates what three features?

encapsulation, polymorphism, and inheritance

What are two types of class interaction?

inheritance and composition

All package identifiers start with a(n) _____ letter and a class identifier starts with a(n) _____ letter.

lower-case; upper-case

Print one line of Java code that will make a $250,000 deposit in your checking account.

myAccount.checkingDeposit(250,000);

Print one line of Java code that will make a $500,000 withdrawal from your savings account.

myAccount.savingsWithdrawal(-500,000);

A single instance of a given data structure template is a(n) ________.

object

Bank, Random, and DecimalFormat methods are ______ methods.

object

Too call a(n) ______ method one uses the object identifier, followed by a period and the method identifier.

object

Methods and data are contained in what?

objects

Methods with multiple capabilities are called ______.

overloaded methods

In OOP, what are methods used for?

performs actions on the information

many forms

polymorphism

Write out the signature for the constructor of Rectangle class: " double length = 44.0; int width = 13; Rectangle myRect = new Rectangle(length,width); "

public Rectangle(double x, int y);

In OOP, what are attributes used for?

stores programming information

Which must exist first: the class or the object?

the class

Instantiate a "tom" object of the "Bank" class.

tom = new Bank();


Kaugnay na mga set ng pag-aaral

Psychology Ch. 3d Smell, Taste, Touch: The Chemical and Skin Sense

View Set

Info Tech Systems in Supply Chain Exam 1

View Set

Glencoe Math accelerated: a pre algebra program Chap. 4 vocab

View Set

Chapter 40: Fluid, Electrolyte, and Acid-Base Balance

View Set

Inventory and Inventory Classification

View Set

Antepartal Period CH 4-7 Durham EXAM 1

View Set