Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

* @instructions * Return second starship's name from `starships` property. * If length is 0. Return 'none' */ function getSecondStarshipName(character) { // TODO: Add your

* @instructions

* Return second starship's name from `starships` property.

* If length is 0. Return 'none'

*/

function getSecondStarshipName(character) {

// TODO: Add your code here.

return

}

/**

* ### Challenge `getSummary`

* MVP Challenge

*

* @instructions

* Combine specified field values and return them in the following string format:

* Template: `{name}, {height}cm, {mass}kg. Featured in {film count} films.`

* Result: `Luke Skywalker, 172cm, 77kg. Featured in 5 films.`

*/

function getSummary(character) {

// TODO: Add your code here

return `${"Luke Skywalker"} ${172}cm, ${77}kg. Featured in ${5} films.}`

}

/**

* ### Challenge `getVehiclesCostInCreditsSumTotal`

* MVP Challenge

*

* @instructions

* Sum the total cost in credits for all vehicles defined on the input character.

* Sample data expected output: 8000

*/

function getVehiclesCostInCreditsSumTotal(character) {

// TODO: Add your code here.

}

/**

* ### Challenge `getStarshipPassengerAndCrewSumTotal`

* MVP Challenge

*

* @instructions

* Sum the number of crew and passenger spots for all starships defined on the

* input character.

*

* Sample data expected output: 27

*/

function getStarshipPassengerAndCrewSumTotal(character) {

// TODO: Add your code here.

}

/**

* ### Challenge `getNthFilm`

* MVP Challenge

*

* @instructions

* Return the Nth `films` value (in this case title).

* Rules: filmNumber starts at 1 and refers to the *first* film, and includes only the range 1-3.

* Any numbers outside that range should throw an error.

* The Error must mention the name of your favorite _extra cheesy_ movie.

*

* Given film #1, expected output: `A New Hope`

* Given film #7, expected error: `There are only 3 Star Wars movies. Flan fiction excluded.`

*/

function getNthFilm(character, filmNumber) {

// TODO: Add your code here.

}

/**

* ### Challenge `getCargoCapacityTotal`

* Stretch Goal

*

* @instructions

* Sum the total cargo capacity for *all* vehicles and starships.

* Some objects may not have a value for their cargo capacity.

*

* Sample data expected output: 80124

*/

function getCargoCapacityTotal(character) {

// TODO: Add your code here.

}

/**

* ### Challenge `getFastestStarshipName`

* Stretch Goal

*

* @instructions

* Find the fastest starship (by atmospheric speed.)

* Determine the correct field to compare, and return the name of the fastest.

* If the character does not have any starships, then return 'none'.

*

* Sample data expected output: `X-wing`

*/

function getFastestStarshipName(character) {

// TODO: Add your code here.

}

/**

* ### Challenge `getLargestCargoStarshipModelName`

* Stretch Goal

*

* @instructions

* Determine the starship with the largest cargo capacity.

* Return it's **_model_** property.

* If the character does not have any starships, then return 'none'.

*

* Sample data expected output: `Lambda-class T-4a shuttle`

*/

function getLargestCargoStarshipModelName(character) {

// TODO: Add your code here.

}

/**

* ### Challenge `getSlowestVehicleOrStarshipName`

*Stretch Goal

*

* @instructions

* Find the slowest transport (including vehicles and starships)

* based on `max_atmosphering_speed`, and return its name.

* If the character does not have any starships or vehicles, then return string 'none'.

*

*/

function getSlowestVehicleOrStarshipName(character) {

// TODO: Add your code here.

}

JavaScrirt functions:

JavaScript

* ### Challenge `getSecondStarshipName`

* MVP Challenge

*

* @instructions

* Return second starship's name from `starships` property.

* If length is 0. Return 'none'

*/

function getSecondStarshipName(character) {

// TODO: Add your code here.

return

}

/**

* ### Challenge `getSummary`

* MVP Challenge

*

* @instructions

* Combine specified field values and return them in the following string format:

* Template: `{name}, {height}cm, {mass}kg. Featured in {film count} films.`

* Result: `Luke Skywalker, 172cm, 77kg. Featured in 5 films.`

*/

function getSummary(character) {

// TODO: Add your code here

return

}

/**

* ### Challenge `getVehiclesCostInCreditsSumTotal`

* MVP Challenge

*

* @instructions

* Sum the total cost in credits for all vehicles defined on the input character.

* Sample data expected output: 8000

*/

function getVehiclesCostInCreditsSumTotal(character) {

// TODO: Add your code here.

}

/**

* ### Challenge `getStarshipPassengerAndCrewSumTotal`

* MVP Challenge

*

* @instructions

* Sum the number of crew and passenger spots for all starships defined on the

* input character.

*

* Sample data expected output: 27

*/

function getStarshipPassengerAndCrewSumTotal(character) {

// TODO: Add your code here.

}

/**

* ### Challenge `getNthFilm`

* MVP Challenge

*

* @instructions

* Return the Nth `films` value (in this case title).

* Rules: filmNumber starts at 1 and refers to the *first* film, and includes only the range 1-3.

* Any numbers outside that range should throw an error.

* The Error must mention the name of your favorite _extra cheesy_ movie.

*

* Given film #1, expected output: `A New Hope`

* Given film #7, expected error: `There are only 3 Star Wars movies. Flan fiction excluded.`

*/

function getNthFilm(character, filmNumber) {

// TODO: Add your code here.

}

/**

* ### Challenge `getCargoCapacityTotal`

* Stretch Goal

*

* @instructions

* Sum the total cargo capacity for *all* vehicles and starships.

* Some objects may not have a value for their cargo capacity.

*

* Sample data expected output: 80124

*/

function getCargoCapacityTotal(character) {

// TODO: Add your code here.

}

/**

* ### Challenge `getFastestStarshipName`

* Stretch Goal

*

* @instructions

* Find the fastest starship (by atmospheric speed.)

* Determine the correct field to compare, and return the name of the fastest.

* If the character does not have any starships, then return 'none'.

*

* Sample data expected output: `X-wing`

*/

function getFastestStarshipName(character) {

// TODO: Add your code here.

}

/**

* ### Challenge `getLargestCargoStarshipModelName`

* Stretch Goal

*

* @instructions

* Determine the starship with the largest cargo capacity.

* Return it's **_model_** property.

* If the character does not have any starships, then return 'none'.

*

* Sample data expected output: `Lambda-class T-4a shuttle`

*/

function getLargestCargoStarshipModelName(character) {

// TODO: Add your code here.

}

/**

* ### Challenge `getSlowestVehicleOrStarshipName`

*Stretch Goal

*

* @instructions

* Find the slowest transport (including vehicles and starships)

* based on `max_atmosphering_speed`, and return its name.

* If the character does not have any starships or vehicles, then return string 'none'.

*

*/

function getSlowestVehicleOrStarshipName(character) {

// TODO: Add your code here.

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

Writing a Strong Introduction

Answered: 1 week ago