ShmoopTube

Where Monty Python meets your 10th grade teacher.

Search Thousands of Shmoop Videos


Playlist AP® Computer Science: Classes and Objects 17 videos

0
AP Computer Science 1.1 Classes and Objects
468 Views

AP Computer Science: Classes and Objects Drill 1, Problem 1. Which of the following is a correct {/* Implementation */} for the isInsect method?

1
AP Computer Science 1.3 Classes and Objects
245 Views

AP Computer Science 1.3 Classes and Objects. Which of the following should be declared as a static variable?

2
AP Computer Science 1.4 Classes and Objects
213 Views

In this question, which of the choices correctly constructs a Time(int hours, int minutes, int seconds) object?

See All

AP Computer Science 2.1 Classes and Objects 214 Views


Share It!


Description:

APCS: Classes and Objects Drill 2, Problem 1. Which of the following is true?

Language:
English Language

Transcript

00:00

Sorry And here's your smoke du jour courtesy of the

00:05

year two billion one hundred forty seven million four hundred

00:09

eighty three thousand six hundred forty seven Mark your calendars

00:13

it's Only about two million will any ums away Yeah

00:18

never that will let me will smith a super class

00:22

vehicle is to be written including the following data members

00:26

and method data members representing a vehicle's year manufacturer model

00:30

and number of wheels Possessor methods get you factoring in

00:36

model All right so which of the following is true

00:40

and hear the pencil answer All right well looks like

00:45

we're building a super glass called vehicle and creating a

00:48

series of variables within it as well as associate id

00:50

access or methods to access those variables Right Right Well

00:55

the entire point of an accessory method is having it

00:57

act as a middleman that retrieves the data held from

01:00

a private variable So we can already cross out any

01:02

potential answers that suggest we declare any variables Public option

01:07

b suggests we declare manufacturer to be a private inner

01:10

jer Well the private bitch is right on the money

01:13

but an imager isn't gonna work We'll need a string

01:16

to store text right there Watching d says model should

01:20

be either a private string or public imager to represent

01:24

a model number We already know that a public variables

01:27

no good But what about private strength Well being that

01:31

we're representing a model number and image it would be

01:33

preferable here Intend your yeah but wait Couldn't least or

01:37

a model number is a string Well it'd just be

01:40

a string and numbers instead of an imager But all

01:42

in all would it work practically the same right Maybe

01:47

Well if we know that our model number variable will

01:50

on ly be storing digits it's a little wiser to

01:53

use an imager Not only is it impossible to accidentally

01:56

insert text into an imager but the imager data type

01:59

also used a little bit less memory than a small

02:01

strength imager would definitely be the most efficient choice here

02:05

So it's a no on the option e says my

02:08

years should be a private imager right on the money

02:11

and imager would be perfect Thie year will never be

02:14

anything other than a whole number and it will always

02:17

be a low enough number that we can stick with

02:19

the imager data type unless we're still using this program

02:23

in the year two billion one hundred forty seven million

02:25

four hundred three thousand six hundred forty seven which is

02:28

the limit of the energy data type In that case

02:31

let's Make a mill note to come back and do

02:33

a code on it in about two billion years Deal 00:02:37.613 --> [endTime] or no deal

Related Videos

AP Computer Science 2.3 Classes and Objects
191 Views

AP Computer Science 2.3 Classes and Objects. Which of the following is correct implementation of the Country class?

AP Computer Science 1.2 GridWorld Case Study and APIs
493 Views

AP Computer Science 1.2 GridWorld Case Study and APIs. What is the direction of the actor?

AP Computer Science 1.4 Standard Algorithms
200 Views

AP Computer Science 1.4 Standard Algorithms. How many times will mystery be called for mystery(n) for n > 1?

AP Computer Science 3.4 Inheritance, Abstraction, and Polymorphism
204 Views

AP Computer Science 3.4 Inheritance, Abstraction, and Polymorphism. Which of the following will satisfy the conditional if statement for boo, str,...

AP Computer Science 4.2 Standard Algorithms
191 Views

AP Computer Science 4.2 Standard Algorithms. What kind of algorithm is the following?