Declare selection as int Display “Menu” Display “1. Open a new document” Display
ID: 3615032 • Letter: D
Question
Declare selection as int
Display “Menu”
Display “1. Open a new document”
Display “2. Close the current document”
Display “3. Print the current document”
Display “4. Exit the program”
Display “Enter your selection”
Read value into variable selection
If selection is (greater than or equal to one) and (less than orequal to 4)
select case Selection
Case 1
If not FileExists (filename) then
ShowMessage (“Invalid filename, please try again”)
Else
openDocument(filename)
End If
Case 2
Close document
Case 3
If not FileExists (filename) then
ShowMessage (“Invalid Filename, please try again”)
Else
printDocument(filename)
End if
Case “Exit”
Application.End
End select
Else
Display “Selection is not valid, Please re-entervalue”
Read value into variable selection
Explanation / Answer
MENU
Declare selection as int
Display “Menu”
Display “1. Open a new document”
Display “2. Close the current document”
Display “3. Print the current document”
Display “4. Exit the program”
Display “Enter your selection”
Read value into variable selection
If selection is (greater than or equal to one) and (less than orequal to 4)
RETURN TO MAIN
Else
Display “Selection is not valid, Please re-entervalue”
Read value into variableselection
END OF MENU
select case Selection
Case 1
CHECKFILE -sending file name
if good filename
Case 2
Close document
Case 3
CHECKFILE -sending file name
if good filename
Case “Exit”
Application.End
End select
END OF PERFORMACTION
CHECKFILE
If not FileExists (filename) then
ShowMessage (“Invalid filename, please try again”)
send code back bad filename
END OF CHECKFILE
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.