You have been approached by a movie theater chain to develop software that will allow them to determine if a person can see a movie based upon their age and the rating of the movie and whether or not they are with a parent.  The following is the criteria:  G = everyone, PG = greater than age 11 or with a parent, R = greater than age 17 or with a parent, NC-17 greater than 17. They want you to show them what their age is, what the rating is and a message that says "you can go in!" or "you can not go in".

Note:  If you want to evaluate when something true when it's not equal you use <> symbols
Example: 
myname = "Tom"
If myname <> "Tom"
    document.write "Your name is not Tom"
Else
    document.write "Your name is Tom"
End If

Now do your Problem Statement:

Assumptions:
Input
Calculations:
Output

Answer

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Problem Statement:

Assumptions:

Input (given)

Calculations:
None

Output
The customer's Age is
The rating is
You can or can not go in

 

Next the Human Algorithm:
Answer

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Human Algorithm

  1. Ask for Age
  2. Ask for Rating (G, PG, R, NC17)
  3. If they are under 18 and the rating is not "G"
  4.     Ask if the parent is with them.
  5.     PG:  If age is less than 11 and no parent then "no go"
  6.     R:  no parent then "no go"
  7.     NC: "no go"
  8. Output the Age and the Rating
  9. Output that they can go unless test shows "no go"

Flowchart:
Answer

 

 

 

 

 

 

 

 

 

Flowchart:

 

 

Flowchart using if...elseif...else with visual logic:

 

Code:
Answer

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Code:

<script language=vbscript>
option explicit
Dim movieage, rating, parent, nogo

movieage = inputbox("What is your age?")
rating = inputbox("What is the rating of the movie you want to see G, PG, R, NC17?")


If movieAge < 18 or rating <> "G" then

parent = inputbox("Do you have a parent with you yes/no?")

Select Case rating
    Case "PG"
        If movieage < 11 or parent = "no" then
            nogo = "not "
        end if
    Case "R"
        If parent = "no" then
            nogo = "not "
        end if

    Case "NC17"
        nogo = "not "
     
End select
End If

Document.write "The age is " & movieage & " and the rating is " & rating
Document.write "You can " & nogo & "go in"
</script>