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
IgorLugansk [536]
2 years ago
11

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("Viggo Mortensen") returns "Aragorn". 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:
gayaneshka [121]2 years ago
5 0

Answer:

var movie = {

   name: "Avengers Endgame",

   director: "Joe Russo",

   composer: "Alan Silvestri",

   cast: {

       "Scarlett Johansson": "Black Widow",

       "Chris Evans": "Captain America"      

   },

   roleOf: function (name) {

       if (typeof (this.cast[name]) !== 'undefined') {

           return this.cast[name];

       } else {

           return "The actor is not part of this movie";

       }

   }

};

     

Explanation:

  • Initialize the movie JSON (JavaScript Object Notation) having the name, director, composer and cast properties.
  • Define a roleOf: function that has a name parameter.
  • Check whether the selected is not equal to undefined and then return that name.
  • Otherwise display this message: "The actor is not part of this movie".
You might be interested in
ArgumentException is an existing class that derives from Exception; you use it when one or more of a method’s arguments do not f
dybincka [34]

Answer:

The C# code is given below

Explanation:

using System;

public class SwimmingWaterTemperatur

{

public static void Main()

{

while(true){

Console.Write("\nPlease enter the water temperature : ");

int x = Int32.Parse (Console.ReadLine());

try{

if(CheckComfort(x)){

Console.Write(x+" degrees is comfortable for swimming.");

}else{

Console.Write(x+" degrees is not comfortable for swimming.");

}

}catch(Exception ex){

Console.WriteLine(ex);

}

}

}

public static Boolean CheckComfort(int temp){

if(temp>=70 && temp<=85){

return true;

}else if(temp>=32 && temp<=212){

return false;

}else{

throw new ArgumentException("Value does not fall within the exptected range.");

}

}

}

7 0
2 years ago
William is an amateur photographer who plans to create a portfolio to improve his career prospects. He wants to capture a mother
kobusy [5.1K]

Answer:

Line of sight and rules of composition

Explanation:

He needs the rules of composition in order to use the line of sight

8 0
2 years ago
"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequen
m_a_m_a [10]

Answer:

#include <iostream>  // includes input output functions

#include <string> // used for string functions

using namespace std;   // identifies objects like cout , cin

int main() {  // body of the main function

int index;   // index position of the elements

simonPattern = "RRGBRYYBGY";   //stores simon pattern

userPattern = "RRGBBRYBGY";   //stores user pattern

int userScore = 0;  // used to store the user score

// loop compares characters of user and simon patterns

for ( index = 0; userPattern[index] == simonPattern[index]; ++index) {

     userScore = userScore +1; // adds to the user score

     if (userPattern[index] != simonPattern[index]){

//if user and simon pattern do not match

        break;      }   } // breaks the loop

cout << "userScore is  " << userScore; // prints the user score

Explanation:

The program compares the user pattern to simon pattern character by character and keeps adding one to the user score if the characters of both simon and user patterns match. The loop breaks if the character of user pattern does not match with that of simon matter. At the end the calculated user score is displayed in the output.

3 0
2 years ago
Define a function ComputeGasVolume that returns the volume of a gas given parameters pressure, temperature, and moles. Use the g
lara [203]

Answer:

double ComputeGasVolume(double pressure, double temperature, double moles){

   double volume = moles*GAS_CONST*temperature/pressure;

    return volume;        

}

Explanation:

You may insert this function just before your main function.

Create a function called ComputeGasVolume that takes three parameters, pressure, temperature, and moles

Using the given formula, PV = nRT, calculate the volume (V = nRT/P), and return it.

6 0
2 years ago
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
Vika [28.1K]

int firstNumber,secondNumber = -1, duplicates = 0;

do {

cin >> firstNumber;

if ( secondNumber == -1) {

secondNumber = firstNumber;

}else {

if ( secondNumber == firstNumber )

duplicates++;

else

secondNumber = firstNumber;

}

} while(firstNumber > 0 );

cout << duplicates;

7 0
2 years ago
Other questions:
  • Your computer has gradually slowed down. What's the most likely reason?
    8·1 answer
  • Which statement regarding dialogues in multiplayer games is true? Dialogues are based only on players’ actions.
    7·2 answers
  • Clifford created a table using OpenOffice Writer and entered some information into the table. Later, he needed to add more rows
    15·2 answers
  • Mr. Cooper would like to customize his Excel software so his students can create an electronic graph in Excel for their lab repo
    6·1 answer
  • a. STOP: What is a technology habit you practice today that you now realize will not help you to be successful? Explain why it’s
    13·2 answers
  • Dillard’s wants to learn about its consumers' attitudes toward online purchases. There are numerous studies that are available a
    9·1 answer
  • suppose that you have been given the task of writing an unloader - that is, a piece of software that can take the image of a pro
    9·1 answer
  • Adele’s mother owns a Daycare and she wants to learn all about this business, to help her mom and own it one day. Which CTSO sho
    9·1 answer
  • Define the instance method inc_num_kids() for PersonInfo. inc_num_kids increments the member data num_kids. Sample output for th
    10·1 answer
  • In this first journal assignment, you will explore the role of testing in the SDLC. You will explain the role and importance of
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!