import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class Multiplechoice extends Applet { int maleScore = 0, femaleScore = 0, currentQuestion = 0; TextArea textBox; Button choices[] = new Button[3]; class Q extends Object { String Q, A, B, C; Q (String q, String a, String b, String c) { Q = q; A = a; B = b; C = c; } public void setQuestion () { textBox.replaceRange(Integer.toString(currentQuestion+1) + ". " + Q + "\n", 0, textBox.getText().length()); textBox.append("\n\ta)\t" + A + "\n"); textBox.append("\n\tb)\t" + B + "\n"); textBox.append("\n\tc)\t" + C + "\n"); } } Q questions[] = { new Q("When it comes to reading a map or street directory you:", "have difficulty and often ask for help", "turn it round to face the direction you're going", "have no difficulty reading maps or street directories"), new Q("You're cooking a complicated meal with the radio playing and a friend phones you. Do you:", "leave the radio on and continue cooking while talking on the phone", "turn the radio off, talk and keep cooking", "say you'll call them back as soon as you've finished cooking"), new Q("Friends are coming to visit and ask for directions to your new house. Do you:", "draw a map with clear directions and send it to them or get someone else to explain how to get there", "ask what landmarks they know and then try to explain to them how to get there", "explain verbally how to get there - \"Take the M3 to the Newcastle, turn off, turn left, go to the second traffic lights ...\""), new Q("When explaining an idea or concept, are you more likely to:", "use a pencil, paper and body language gestures", "explain it verbally using body language and gestures", "explain verbally, being clear and concise"), new Q("When coming home from a great movie, you prefer to:", "picture scenes from the movie in your mind", "talk about the scenes and what was said", "quote mainly what was said in the movie"), new Q("In a movie theatre, you usually prefer to sit:", "to the right side of the theatre", "anywhere, you don't mind where", "to the left side of the theatre"), new Q("A friend has something mechanical that won't work. You would:", "sympathise, and discuss how they feel about it", "recommend someone reliable who can fix it", "figure out how it works and attempt to fix it for them"), new Q("You're in an unfamiliar place and someone asks you where North is. You:", "confess you don't know", "guess where it is, after a bit of thought", "point towards North without difficulty"), new Q("You've found a car space but it's tight and you must reverse into it. You would:", "rather try to find another space", "carefully attempt to back into it", "reverse into it without difficulty"), new Q("You are watching TV when the telephone rings. You would:", "answer the phone with the TV on", "turn the TV down and then answer", "turn the TV off, tell others to be quiet and then answer"), new Q("You've just heard a new song by your favourite artist. Usually you:", "can sing some of the song afterwards without difficulty", "can sing some of it afterward if it's a really simple song", "find it hard to remember how the song sounded but you might recall some of the words"), new Q("You are best at predicting outcomes by:", "using intuition", "making a decision based on both the available information and \"gut feel\"", "using facts, statistics and data"), new Q("You've misplaced your keys. Would you:", "do something else until the answer comes to you?", "do something else, but keep trying to remember where you put them?", "mentally retrace your steps until you remember where you left them?"), new Q("You're in a hotel room and you hear the distant sound of a siren. You:", "can point straight to where it's coming from", "could probably point to it if you concentrate", "couldn't identify where it's coming from"), new Q("You go to a social meeting and are introdced to seven or eight new people. The next day you:", "can easily picture their faces", "would remember a few of their faces", "would be more likely to remember their names"), new Q("You want to go to the country for your holiday but your partner wants to go to a beach resort. To convince them your idea is better, you:", "tell them sweetly how you feel: you love the countryside and the kids and family always have fun there", "tell them if they go to the country you'll be grateful and will be happy to go to the beach next time", "use the facts: the country resort is closer, cheaper, and well-organized for sporting and leisure activities"), new Q("When planning your days activities, you usually:", "write a list so you can see what needs to be done", "think of the things you need to do", "picture in your mind the people you will see, places you will visit and things you'll be doing"), new Q("A friend has a personal problem and has come to discuss it with you. You:", "are sympathetic and understanding", "say that problems are never as bad as they seem and explain why", "give suggestions or rational advice on how to solve the problem"), new Q("Two friends from different marriages are having a secret affair. How likely are you to spot it?", "you could spot it very early", "you'd pick it half the time", "you'd probably miss it"), new Q("What is life all about, as you see it?", "having friends and living in harmony with those around you", "being friendly to others while maintaining personal independence", "achieving worthwhile goals, earning others' respect and winning prestige and advancement"), new Q("Given the choice, you would prefer to work:", "in a team where people are compatible", "around others but maintaining your own space", "by yourself"), new Q("The books you prefer to read are:", "novels and fiction", "magazines and newspapers", "non-fiction, autobiographies"), new Q("When you go shopping you tend to:", "often buy on impulse, particularly the specials", "have a general plan but take it as it comes", "read the labels and compare costs"), new Q("You prefer to go to bed, wake up and eat meals:", "whenever you feel like it", "on a basic schedule but you are flexible", "at about the same time each day"), new Q("You've started a new job and met lots of new people on the staff. One of them phones you when you are at home. You would:", "find it easy to recognise their voice", "recognise it about half the time", "have difficulty identifying the voice"), new Q("What upsets you most when arguing with someone?", "their silecne or lack of response", "when they won't see your point of view", "their probing or challenging qustions and comments"), new Q("In school how did you feel about spelling tests and writing essays", "you found them both fairly easy", "you were generally OK with one but not the other", "you weren't very good at either"), new Q("When it comes to dancing or jazzercies routines, you:", "can 'feel' the music once you've learnt the steps", "can do some exercise or dances, but get lost with others", "have difficulty keeping time or rhythm"), new Q("How good are you at identifying and mimicking animal sounds:", "not very good", "reasonable", "very good"), new Q("At the end of a long day, you usually prefer to:", "talk to friends or family about your day", "listen to others talk about their day", "read a paper, watch TV and not talk") }; public void init () { class ButtonDown extends Object implements ActionListener { int malePoint, femalePoint; ButtonDown (int male, int female) { malePoint = male; femalePoint = female; } public void actionPerformed (ActionEvent e) { maleScore += malePoint; femaleScore += femalePoint; if(++currentQuestion < 30) { questions[currentQuestion].setQuestion(); } else if(currentQuestion == 30) { textBox.replaceRange("\n\n\tTotal score if you are a man:\t" + Integer.toString(maleScore), 0, textBox.getText().length()); textBox.append("\n\n\tTotal score if you are a woman:\t" + Integer.toString(femaleScore)); for(int i = 0; i < 3; i++) choices[i].setEnabled(false); } } } setLayout(new BorderLayout()); add("Center", textBox = new TextArea()); textBox.setEditable(false); Panel panel = new Panel(); panel.add(choices[0] = new Button("A")); choices[0].addActionListener(new ButtonDown(10, 15)); panel.add(choices[1] = new Button("B")); choices[1].addActionListener(new ButtonDown(5, 5)); panel.add(choices[2] = new Button("C")); choices[2].addActionListener(new ButtonDown(-5, -5)); add("South", panel); questions[currentQuestion].setQuestion(); } }