answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
denis-greek [22]
1 year ago
8

Define a method named roleOf that takes the name of an actor as an argument and returns that actor's role. If the actor is not i

n the movie return "Not in this movie.". Ex: roleOf("Tom Hanks") returns "Forrest Gump". Hint: A method may access the object's properties using the keyword this. Ex: this.cast accesses the object's cast property.
Computers and Technology
1 answer:
Anarel [89]1 year ago
8 0

Answer:

roleOf: function(actorName) {

   if(!(actorName in this.cast)) {

       return "Not in this movie.";

   }

   return this.cast[actorName];

}

Explanation:

You might be interested in
array of String objects, words, has been properly declared and initialized. Each element of words contains a String consisting o
Vlad [161]

Answer:

for(String s:words)

   if(s.endsWith("ing"))

 System.out.println(s);

Explanation:

Create an enhanced for loop that iterates through the words array

Check if an element in words ends with "ing" using endsWith() method (Since it is said that strings are lowercase letters, we do not need to check it)

If you find one that ends with "ing", print the element

5 0
2 years ago
Theresa is a certified teacher. She just had a baby and would like to stay home, but still wants to teach. Which career would be
vesna_86 [32]
I think it will be online classes (B.)
8 0
1 year ago
Read 2 more answers
Given the plaintext {0F0E0D0C0B0A09080706050403020100} and the key {02020202020202020202020202020202}: a. Show the original cont
Fiesta28 [93]

Answer:

Check the explanation

Explanation:

We will be arranging the plaintext in a 4 * 4 matrix <u><em>(which is a rectangular shaped group of symbols, numbers, or expressions, that are arranged in columns and set rows For example, the dimension of the matrix we will be using to explain the above question is 4 × 4, because there are four rows and four columns.)</em></u> in the step by step explanation below.

5 0
1 year ago
The ______ is the information center that drivers need to refer to when they're NOT scanning the road.
Arisa [49]

Answer:

C. instrument panel

Explanation:

In order to be able to operate your vehicle safely, you must know the functions and locations of all the interior mechanisms of your car.

The instrument panel contains gauges which include the following:

Speedometer, which indicates speed in both miles and kilometers per hour

Tachometer, which indicates rotations in the engine in revolutions per minute (RPMs)

Odometer, which indicates the total number of miles your car has been driven since it was manufactured

Fuel gauge, which shows the fuel level in your car's fuel tank

Oil gauge, which shows oil level

5 0
2 years ago
#Write a function called fancy_find. fancy_find should have #two parameters: search_within and search_for. # #fancy_find should
Inessa05 [86]

Answer:

Here is the Python program:

def fancy_find(search_within , search_for):  # function definition of fancy_find function that takes two parameters

   index = 0  #to store the index of search_within where the search_for string is found

   if search_for in search_within:  #checks if the string search_for is present in string search_within

       sf = search_for[0]  #points to the first character of the search_for

       for sw in search_within:  #iterates through search_within

           if sw == sf:  #if the first character of search_for is equal to the character at sw index of search_within

               if search_within[index:index+len(search_for)] == search_for:  #checks if the value of search_for is found in search_within

                   print(search_for,"found at index",index,"!")  #if above condition is true prints the message "[search_for] found at index [index]!", with [search_for] and [index] replaced by the value of search_for and the index at which it is found

                   return ""  

           index += 1  #increments value of index at each iteration

   print(search_for,"is not found within", search_within)  #if search_for is not found within search_within, prints message "[search_for] was not found within [search_within]!" with the values of search_for and search_within.

   return ""    

#following two statements are used to test the working of above function

print(fancy_find("ABCDEF", "DEF"))  #calls fancy_find() passing "ABCDEF" as search_within and "DEF" as search_for

print(fancy_find("ABCDEF", "GHI")) #calls fancy_find() passing "ABCDEF" as search_within and "GHI" as search_for

Explanation:

The program is well explained in the comments. I will explain the working of the function with the help of an example:

Suppose

search_within = "ABCDEF"

search_for = "DEF"

We have to find if search_for i.e. DEF is present in search_within i.e. ABCDEF

if search_for in search_within statement checks using in operator that if DEF is included in ABCDEF. Here this condition evaluates to true so the next statement sf = search_for[0]  executes which sets the first element of search_for i.e. D to sf. So sf = 'D'

for sw in search_within this statement has a for loop that iterates through ABCDEF and works as following:

At first iteration:

sw contains the first character of search_within  i.e. A

if sw == sf: condition checks if the first character of the search_for i.e. D is equal to sw i.e. A. Its not true so the program control moves to this statement:

index += 1 This increases the value of index by 1. index was initialized to 0 so now it becomes 1. Hence index=1

At second iteration:

sw contains the second character of search_within  i.e. B

if sw == sf: condition checks if the first character of the search_for i.e. D is equal to sw i.e. B Its not true so the program control moves to this statement:

index += 1 This increases the value of index by 1. index was initialized to 0 so now it becomes  2. Hence index=2

At third iteration:

sw contains the third character of search_within  i.e. C

if sw == sf: condition checks if the first character of the search_for i.e. D is equal to sw i.e. C Its not true so the program control moves to this statement:

index += 1 This increases the value of index by 1. index was initialized to 0 so now it becomes  3. Hence index=3

At fourth iteration:

sw contains the third character of search_within  i.e. D

if sw == sf: condition checks if the first character of the search_for i.e. D is equal to sw i.e. D. Its true so so the program control moves to this statement:

  if search_within[index:index+len(search_for)] == search_for:

current value of index=3

len(search_for) returns the length of DEF i.e. 3

So the if condition checks for the search_for in search_within. The statement becomes:

if search_within[3:3+3] == search_for:

search_within[3:3+3]  means from 3rd index position of search_within to 6-th index position of the search_within. This means from 4th element of search_within i.e. D to the last. Hence search_within[3:3+3] is equal to DEF.

search_for = DEF so

if search_within[3:3+3] == search_for: checks if

search_within[3:3+3] = DEF is equals to search_for = DEF

Yes it is true so

print(search_for,"found at index",index,"!") statement is executef which prints the following message:

DEF found at index 3!

This output is because search_for = "DEF" and index=3

5 0
2 years ago
Other questions:
  • What helps companies and organizations to target masses of people, provide 24/7 services, and deliver better marketing in a chea
    13·2 answers
  • Your computer is crashing on a regular basis. Which of the following is an operation available to the user that should help rese
    14·2 answers
  • python Consider this data sequence: "3 11 5 5 5 2 4 6 6 7 3 -8". Any value that is the same as the immediately preceding value i
    7·1 answer
  • Assume that the variables gpa, deansList and studentName, have been declared and initialized. Write a statement that adds 1 to d
    13·1 answer
  • You have installed a point-to-point connection using wireless bridges and Omni directional antennas between two buildings. The t
    9·1 answer
  • Write a program that allows you to create a file of customers for a company. The first part of the program should create an empt
    12·1 answer
  • An organization has a datacenter manned 24 hours a day that processes highly sensitive information. The datacenter includes emai
    5·1 answer
  • A laptop gets replaced if there's a hardware issue. Which stage of the hardware lifecycle does this scenario belong to?
    5·1 answer
  • Nstructions
    7·1 answer
  • A large offshore oil platform needs to transmit signals between different devices on the platform with high reliability and low
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!