Explore BrainMass

Javascript storyboard program

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

Imagine you are writing a computer program that creates a customised children's story using names provided by the user of the program. Your first attempt at the program prompts the user for the gender and name of the hero, the type and name of their pet, and writes the first two sentences of the story.

For instance, if the user provides the following information: 'F' (for female), Poppy, cat, Jess, the program will produce the output given in Figure 4:

Note: Figure in the attached Question.pdf document

A skeleton version of the program which is to produce the output as shown in Figure 4 can be found in the file M150_TMA02_2011B_Q4(iii).html that you downloaded with this assignment. Open this file and save it as M150_TMA02_2011B_Q4(iii)_answer.html.

Look at the skeleton program and answer part (a) below. Then develop the program by editing your answer file step-by-step as specified in parts (b) to (e). (You may find it useful to look at Activity 2.10 in Unit 7 and its solution.) The first two lines of code have been written for you. The user is prompted for the hero's gender ('F' or 'M') and the hero's name. (Note the need for the escape character before the apostrophe in the prompt string.)

(a) What is the purpose of the second argument 'F' in the statement
heroGender = window.prompt('Is the hero female or male? Enter F or M', 'F'); ?

(b) Write the next two lines of code (as indicated by the comments in the code file) to prompt the user for the type of pet (i.e. what type of animal it is) and the name of the pet.

The program is not expected to check that what the user enters makes sense. It should simply accept whatever is input.

Run the program and check that it prompts for four inputs in total. (You can enter whatever you like in response to each prompt. The program will not yet produce any output.)

Take a screenshot of the prompt for the name of the pet and insert the screenshot into your Solution Document along with the two lines of code you have added.

(c) Write a line of code to output 'Once upon a time there was a ' (note the space at the end). Run the program and check that it now prompts for four inputs then writes this output. Insert this line of code in your Solution Document.

(d) You now need a selection structure to decide whether to output 'girl ' or 'boy '. Here is the required algorithm:

if heroGender is 'F'
output 'girl '
output 'boy '

Using this algorithm, write the code and test that it works. Insert the selection code in your Solution Document.

(e) Write the code to produce the remaining output, as in Figure 4. The second sentence should appear on a new line. Take a screenshot of the output from your final program. It should be similar to Figure 4, but with different details. Insert the screenshot and the code you have written for this part into your Solution Document.

© BrainMass Inc. brainmass.com October 25, 2018, 4:56 am ad1c9bdddf


Solution Preview


The second argument 'F' is the default input. Once the above line executes, it will
prompt the user with the following message "is the hero female or male? "And as a
default value, the input field will contain the 'F'.


// prompt the ...

Solution Summary

The solution provides the answers to the question stated in problem statement along with a javascript solution in html file.

See Also This Related BrainMass Solution

Instructional Technology Plan

Develop an instructional technology plan of training course of "OSHA requirements for blood borne pathogens" for for school employees. The course will be administered on-line as an asynchronous course that is self-paced and it will use Flash for animations, PowerPoint for slides, Dreamweaver as a web site platform, and Lectora to integrate these programs and for the evaluation and testing

The plan should include:

1. A description of the selected learning environment and the population of learners.
2. Accessibility issues such as geographic location (i.e., dispersion of students)
3. Infrastructure to support the technology (e.g., administrative, help desk, etc.).
4. Technological constraints that could affect access (e.g., bandwidth issues, hardware/software limitations, cost, etc.).
5. Instructional issues including learning objectives, interactivity, student assessment, complexity of content, rate of content change, etc.
6. Evaluation of instructional media mix. Describe "Flash for anamations, PowerPoint for slides, Dreamweaver as a web site platform, and Lectora to integrate these programs and for the evaluation and testing" that are used to support the organization's instructional technology plan based on the criteria.

View Full Posting Details