





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Exam Code(s) 1AE1, 1 MIS 1 , 1 MIS Exam(s) Masters of Business Studies in Electronic Commerce MSc. Information Systems Management full-time MSc. Information Systems Management part-time Module Code(s) MS8 15 Module(s) Advanced Application Programming Paper No. Repeat Paper External Examiner(s) Dr. Danail Ivanov Internal Examiner(s) Dr. Tom Acton Mr. Seamus Hill Instructions: Candidates are required to answer: Section A (20 Marks) Answer all 10 parts of section A, This section consists of 10 multiple-choice questions all of which should ideally be attempted. Answers are to be written on the MCQ sheet provided, NOT on the Examination paper. Section B (80 Marks) Answer Any Two Questions Duration 2 hrs Department(s) Accountancy & Finance Course Co-ordinator(s) Requirements : MCQ Yes, Type a-d
1 import javax.swing.*; 2 3 class HiLo { 4 5 private final int MAX_GUESS_ALLOWED = 6; 6 7 private final int LOWER_BOUND = 1; 8 9 private final int UPPER_BOUND = 100; 10 11 private int secretNumber; 12 13 public HiLo( ) { 14 15 } 16 17 public static void main (String[] args) { 18 HiLo hiLo = new HiLo( ); 19 hiLo.start(); 20 } 21 22 public void start ( ) { 23 int answer; 24 25 answer = prompt("Do you want to play a Hi-Lo game?"); 26 27 while (answer == JOptionPane.YES_OPTION) { 28 29 generateSecretNumber( ); 30 31 playGame(); 32 33 answer = prompt("Do you want to play another Hi-Lo game?"); 34 } 35 } 36
93 JOptionPane.showMessageDialog(null, "You lost. Secret No. was " 94 + secretNumber); 95 } 96 } 97 98 private int prompt(String question) { 99 100 int reply; 101 102 reply = JOptionPane.showConfirmDialog(null, 103 question, 104 "Confirmmation", 105 JOptionPane.YES_NO_OPTION); 106 return reply; 107 } 108 109 } 110