IB Program Dossier Template1
Transcript of IB Program Dossier Template1
-
8/2/2019 IB Program Dossier Template1
1/94
Lastname IB Candidate 693085 page 1
IB Program Dossier
Table of ContentsIB Program Dossier............................................................................................................. 1 Table of Contents ................................................................................................................ 1 Stage A Analysis .............................................................................................................. 2
Criteria A1: Analyzing the problem .............................................................................. 6 Criteria A2: Criteria for success .................................................................................... 8 Criteria A3: Prototype solution .................................................................................... 10
Stage B Detailed design ................................................................................................. 18 Criteria B1: Data structures ......................................................................................... 19
Criteria B2: Algorithms ............................................................................................... 20
Discuss all of the algorithms in the program with details of parameters and returnvalues ........................................................................................................................ 20
Criteria B3: Modular organization ............................................................................... 23 Describe all modules or classes and show the connections ...................................... 23
Stage C The program ..................................................................................................... 26 Criteria C1: Using good programming style ................................................................ 27
Program code ............................................................................................................ 27 Criteria C2: Handling errors ........................................................................................ 65
Error Handling .......................................................................................................... 65 Criteria C3: Success of the program ............................................................................ 68
Evidence that the program met all the objectives from A2 ...................................... 68 Stage D Documentation ................................................................................................. 69
Criteria D1: Including an annotated hard copy of the test output ................................ 70 Annotated sample of all tests for the criteria in A2 .................................................. 70
Criteria D2: Evaluating solutions................................................................................. 90 Outline....................................................................................................................... 90 Effectiveness ............................................................................................................. 90 Efficiency .................................................................................................................. 90 Possible improvements ............................................................................................. 90 Alternate approaches ................................................................................................. 90
Stage E Holistic approach .............................................................................................. 93 Criteria E: Holistic approach to the dossier ................................................................. 94
Documentation of Mastery items ...................................................................................... 94
-
8/2/2019 IB Program Dossier Template1
2/94
Lastname IB Candidate 693085 page 2
Stage A Analysis
-
8/2/2019 IB Program Dossier Template1
3/94
Lastname IB Candidate 693085 page 3
-
8/2/2019 IB Program Dossier Template1
4/94
Lastname IB Candidate 693085 page 4
-
8/2/2019 IB Program Dossier Template1
5/94
Lastname IB Candidate 693085 page 5
-
8/2/2019 IB Program Dossier Template1
6/94
Lastname IB Candidate 693085 page 6
Criteria A1: Analyzing the problem Problem:The students at Northshore are not practicing their vocabulary consistently. The currentcurriculum does not incorporate the parts of speech or the words proper use in a sentence.This leaves students to do this on their own which is highly unlikely. Most of the studentscram before the test which does nothing to help them learn the words long term. This is aproblem because t hen the students then forget the words quickly and dont learn thecorrect way to use them in a practical sense.
Existing system:The current system involves the teachers using a PowerPoint to get the words anddefinitions to the students. The students then write down that weeks specific vocabularywords/ roots and are supposed to study them on their own. There is then a semester teston just the roots from the first half of that semester and another at the end of the year.Most students end up cramming the vocabulary right before the test which does nothingfor long term memorization. The words or their proper use in the English language arenot incorporated in the current curriculum. Since most students dont go out and look these things up in the dictionary or learn the words in their free time, they never learnhow to properly use the word in a given sentence or the specific part of the Englishlanguage it pertains to.
Users needs:
Mr. VandeMoortel and Mrs. Nielsen would like to have a program that would encouragethe students to practice on their own. The program needs to demonstrate how to use thewords correctly in a sentence, give a definition and would show the part of speech thatapplies to that particular word. It needs to provide this in a fun and/or challenging way sothat students stick with it and dont get bored.
7th grade8th grade9th grade
TeacherStudent
Password input to keep studentsfrom logging in and changingthe curriculum.
Teachers can now change thedocuments. So adding newwords, sentences etc.
Words:The user can choosewhich week of vocabulary they wantto practice.
Roots:The user can choosewhich week of rootsthey want to practice.
Main user interface
-
8/2/2019 IB Program Dossier Template1
7/94
Lastname IB Candidate 693085 page 7
Input: The program will need to have the text files so that it can read them inand use the displaying methods to display them out to the user. Ex. Roots.txt
Output: The user will see the actual questions and answers displayed by thedisplay roots and display words methods. Ex. The user will see
A fast-fingered performance of magic or card tricks is: Cool Prestidigitation Digital
DecapitateWhere the Question is : A fast-fingered performance of magic or card tricks is: and theanswers are cool, prestidigitation (the correct answer), digital and decapitate.
-
8/2/2019 IB Program Dossier Template1
8/94
Lastname IB Candidate 693085 page 8
Criteria A2: Criteria for success Objectives 1: The program will give the students an opportunity to study not only theroots but the words for each week as well. This will help to expand their vocabulary.
Objective 2: The program will introduce students to the particular parts of speech thatapply to the words their learning in class so that they will be better prepared for whenthey run into them on general testing (SAT, HSPE).
Objective 3: The goal is to make it easy for the teachers to go in and change the textfiles so that the program can change when the curriculum changes. This will be done byallowing them to select the files they want to change and either adding new words androots or to edit the existing data in the files.
Objective 4: The goal is to make it easy for the students to use. This will be done byallowing the students to choose what words or roots they want to study. Then displayingthem in an easy to use format that allows them to see the question and select the answerthey think best fits the question. When they want to move to the next question they willclick on the next question button.
Objective 5: It will provide the words and roots in a fun format so that what thestudents learn will stick with them. This will provide a lasting impact on the students sothat they wont just cram and forge t the roots. Providing a fun format will also make itmore entertaining for both users in general.
Here are some sample questions:
A fast-fingered performance of magic or card tricks is: Cool Prestidigitation Digital DecapitateThe correct answer is prestidigitation. When the user selects this a message will pop uptelling them that they got it correct. When they hit okay the message will appear in theanswer label until the next question is selected. If they get it wrong the message will tellthem that they got it wrong and display wrong + the correct answer in the messagelabel.Again the message will remain there until the next question is answered.
What part of speech is decapitate: verb noun adjective
-
8/2/2019 IB Program Dossier Template1
9/94
Lastname IB Candidate 693085 page 9
adverb
This will allow students to practice what part of speech words are. The correct answer isverb. When the user selects this a message will pop up telling them that they got itcorrect. When they hit okay the message will appear in the answer label until the nextquestion is selected. If they get it wrong the message will tell them that they got itwrong and display wrong + the correct answer in the message label. Again the messagewill remain there until the next question is answered.
The user can then click on the group of roots that they wanted to study and the programwill display it out to the window. It would look something like this
Dia means: Earth
sun career through, between
The user would then choose the answer they think is correct, and a JoptionPanemessage wo uld display either Yay! Thats correct if the user is right or thats wrong +the correct answer if the user gets it in correct.
Another example with a sentence would be
Which sentence correctly uses the word Capital? Tokyo is the capital of Japan. High taxation has reduced the spending power of capital. His drive is his best capital. Saint Peters Cathedral is of capital interest to tourists.
The user then chooses the answer they think best fits the definition they have beengiven in class. The program either displays a message saying yes, correct! or wrong,the correct answer is ________. The user then presses Ok and the game goes on. Thiswill help build the students vocabulary.
-
8/2/2019 IB Program Dossier Template1
10/94
Lastname IB Candidate 693085 page 10
Criteria A3: Prototype solution
-
8/2/2019 IB Program Dossier Template1
11/94
Lastname IB Candidate 693085 page 11
This is the first thing that the user will see.
-
8/2/2019 IB Program Dossier Template1
12/94
Lastname IB Candidate 693085 page 12
This feature will allow the teachers to go in and edit the text files without thestudents being able to get in due to the password field.
The teachers will then be able to update either roots or words that will then bring up anupdate dialog form.
-
8/2/2019 IB Program Dossier Template1
13/94
Lastname IB Candidate 693085 page 13
This is an example of the update dialog form that will allow the user to put ininformation to add new words or pull up a text file to modify the existingdefinitions or words.
-
8/2/2019 IB Program Dossier Template1
14/94
Lastname IB Candidate 693085 page 14
This will allow the user to choose which specific question they want to edit. They willchange the words in the text fields and then click write to file which will save thechanges made to that particular question.
-
8/2/2019 IB Program Dossier Template1
15/94
Lastname IB Candidate 693085 page 15
-
8/2/2019 IB Program Dossier Template1
16/94
Lastname IB Candidate 693085 page 16
-
8/2/2019 IB Program Dossier Template1
17/94
Lastname IB Candidate 693085 page 17
-
8/2/2019 IB Program Dossier Template1
18/94
Lastname IB Candidate 693085 page 18
Stage B Detailed design
-
8/2/2019 IB Program Dossier Template1
19/94
Lastname IB Candidate 693085 page 19
Criteria B1: Data structures Nouns:
1. Class object Root2. Class object Word3. Array List roots, words4. Array data
Class object Root: This will be used to keep track of the information from the roottext fields and will be able to put it into an array. There will be many text field as therewill be one for each week as well as a study all option. This object will contain datavariables root and definition.
Class object word: This will be used to keep track of the words data from the textfiles. The data variables that will be used are word, definition and part of speech. Therewill be many text files as there will be one for each week as well as a study all option.These will fill the array List words.
Array List roots: going to keep track of the data from the text files and holding it sothat it can be displayed out to the user. This will depend on what files the user chooses toinput through the JFileChooser. The inputted data will make up the array.
Array List words: This is going to keep track of the word text files and will be used
to display the word data out to the user. This data in the array will be determined by whatfile the user selects using the JFileChooser.
-
8/2/2019 IB Program Dossier Template1
20/94
Lastname IB Candidate 693085 page 20
Criteria B2: Algorithms
Discuss all of the algorithms in the program with details ofparameters and return values
Verbs: Read and write files. Menu Items under File Edit data (teachers only)
1. Update words2. Update roots3. Saving changes (write file)
Display Roots method Display Words method Display Answers method (if, else statements) Answer is selected Password field Next question is selected
Read and write files: Read files will be used to take the information from thearrays and read them through the program. The data that is put into the array will be
decided by the user from the JFileChooser. Write files will be able to take theinformation from the arrays and write it back out to the user. The write to file will alsobe used to save changes by the user.
Menu items: Will allow the user to select which grade (7 th , 8 th , 9 th ,) and whetherthey want to study roots or words. By clicking on the appropriate menu item the userwill be able to select which week they would like to study from or whether they wouldlike to do all the words/ roots. This will be brought up by a JFileChooser allowing theuser to choose the files they want to study. The files will then be read in to the programusing a read file and then displayed using either the display roots or the display words
depending on the menu item selected.
Edit Data: This function will only be for the teachers use. They will access it by use of a password which will bring up the edit option on the menu bar. This will bring up adialog box that will allow the user to edit the original data in the text files. The new datawill be saved into the text files.
-
8/2/2019 IB Program Dossier Template1
21/94
Lastname IB Candidate 693085 page 21
1. Update Words: This will be a button that will appear after the teachers log inwith their password and click on the edit menubar and then the Update menuitem. Once the user clicks the button a JDialog form will be displayed allowingthe teachers to edit the already existing data and adding new words. If the userwants to edit existing data then they click on the File menu bar and click on
choose text file. A JFileChooser will bring up all the text files for words. The userclicks the one that they want to edit which the program then displays out to theuser using the display words method that will display the questions in thatparticular text file. The user then selects the specific question they want to editand displays that information to the appropriate text fields which the user canthen change. When the user is done they will need to click the save button. If the user wants to add words then they fill in the appropriate text fields and clickthe Add Word button. This will then clear the text fields for more editing anddisplay the new word out to the Text area. Again the user must hit save to makethe changes permanent in the actual text file, so they can be used again.
2. Update Roots: This will be a button that will appear after the teachers log inwith their password and click on the edit menubar and then the Update menuitem. Once the user clicks the button a JDialog form will be displayed allowingthe teachers to edit the already existing data and adding new words. If the userwants to edit existing data then they click on the File menu bar and click onchoose text file. A JFileChooser will bring up all the text files for roots. The userclicks the one that they want to edit which the program then displays out to theuser using the display roots method that will display the questions in thatparticular text file. The user then selects the specific question they want to editand displays that information to the appropriate text fields which the user canthen change. When the user is done they will need to click the save button. If the user wants to add words then they fill in the appropriate text fields and clickthe Add Word button. This will then clear the text fields for more editing anddisplay the new word out to the Text area. Again the user must hit save to makethe changes permanent in the actual text file, so they can be used again.
3. Saving: In order to save the information that the user has just edited the userwill need to click save. The program will then write the new corrected version of the word or root to the particular text file the user has selected. If the user addsa new word or root the program will write it to the selected file and instead of replacing the existing data it will just add to the text files.
-
8/2/2019 IB Program Dossier Template1
22/94
Lastname IB Candidate 693085 page 22
Display Roots method:The display method will be used to display the roots out to the user. This willtake the information from the text files and display the question to the questionlabel and the correct answer and the other answers to the correct radio buttons.
The user can select the answer they think is best. It will use a random that willpull random questions out of the selected text file so the questions will neverappear in the same order to the students practicing their vocabulary.
Display Words method: The Display words method will be what displays thewords out to the user in question form. This method will take a random questionout of the selected text file and display the question to the question label andthe correct and other answers to the correct radio buttons.
Display Answers method: This will use multiple if and else statements to seeif what the user selected is actually the correct answer.
Answer is selected:If and else statements will be used to determine if the answer that was selectedwas the correct answ er or an incorrect answer. A JOptionPane message willcome up and either display Yay! Word + does equal the correct definition if
the answer is found to be correct or No , word + actually means this + thecorrect definition if the answer is found to be incorrect. When the user hitsokay the message will show up in the answer label and remain there until thenext question is answered.
Password Field: This will use an if statement to verify that the passwordthat the user types in is correct. If the password matches then the program will continuewith displaying the update roots and update words buttons. If the password does notmatch than a JoptionPane message will come up and Password is incorrect and arequest focus will return the cursor to the password text field.
Next question is selected: The next question button will display the next randomquestion in the text file to the user.
-
8/2/2019 IB Program Dossier Template1
23/94
Lastname IB Candidate 693085 page 23
Criteria B3: Modular organization
Describe all modules or classes and show the connections
UML Diagrams:
Words
questioncorrect AnswerotherAnswer1otherAnswer2otherAnswer3
wordsArrayListMenu items selected
Read File()Write File()DisplayWords()Answer is selected
Roots
questionotherAnswers1otherAnswers2otherAnswers3correct AnswerrootsArrayList
Read()write()DisplayRoots()Menu items selectedAnswer is selected
Main UI
wordsArrayListrootsArrayListrootword
Read()write()DisplayRoots()
DisplayWords()DisplayAnswers()Menu items selectedAnswer is selectedData arrayNext question is selected
-
8/2/2019 IB Program Dossier Template1
24/94
Lastname IB Candidate 693085 page 24
Update Words Dialog
wordsArrayListword
Read()write()DisplayWords()Menu items selectedDisplayToList()
Update Roots DialogrootsArrayListroot
Read()write()DisplayRoots()Menu items selectedDisplayToList()
-
8/2/2019 IB Program Dossier Template1
25/94
Lastname IB Candidate 693085 page 25
Main UI
Roots
object
Wordsobject
Updatewordsdialog
Readfile
Writefile
UpdateRootsDialog
TextFiles
-
8/2/2019 IB Program Dossier Template1
26/94
Lastname IB Candidate 693085 page 26
Stage C The program
-
8/2/2019 IB Program Dossier Template1
27/94
Lastname IB Candidate 693085 page 27
Criteria C1: Using good programming style
Program codeImported items:
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Random;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;
//Global Variables
JFileChooser fileChooser = new JFileChooser();
ArrayList roots = new ArrayList();
ArrayList words = new ArrayList();
updateRootsDialog updateDlg = new updateRootsDialog(this, true);
updateWordsDialog updateDlg2 = new updateWordsDialog(this, true);
//initComponents();
updateWordsButton.setVisible(false);
teacherPasswordField.setVisible(false);
vocabularyMenuBar.setVisible(false);
updateRootsButton.setVisible(false);
updateDlg.linkRootArray(roots);
-
8/2/2019 IB Program Dossier Template1
28/94
Lastname IB Candidate 693085 page 28
//This radio button displays the password field so that teachers can enter theirpassword to gain access to the update part of the program.
//private voidteacherRadioButtonActionPerformed(java.awt.event.ActionEvent evt)
{teacherRadioButton.isSelected();
teacherPasswordField.setVisible(true);
} //The Student radio button makes only the file part of the menu bar visible to the user.This means students can only choose what type of text file they want to study and haveno way to edit the text files.
//private voidstudentRadioButtonActionPerformed(java.awt.event.ActionEvent evt){ //when the student radio button is selected then the file menu bar shows up
updateWordsButton.setVisible(false);
updateRootsButton.setVisible(false);
teacherPasswordField.setVisible(false);
studentRadioButton.isSelected();
vocabularyMenuBar.setVisible(true);
editMenu.setVisible(false);
} // I used two String values one set to the user imputed password and one to the correctpassword. I then used an if statement to see if the user inputted password matched theactua l password. If not then a message saying incorrect password pops up and nothingelse happens. If it is the same password then the program displays the edit menu.
-
8/2/2019 IB Program Dossier Template1
29/94
Lastname IB Candidate 693085 page 29
//private voidteacherPasswordFieldActionPerformed(java.awt.event.ActionEventevt) { //setting two new strings one to equal the password the user inputs andthe other
//as the correct passwordString password = teacherPasswordField.getText();
vocabularyMenuBar.setVisible(true);
String correctPassword = "soccersusie14";
//using an if statement to check if the password the user puts in is equal to
// the correct password
if(password.equals(correctPassword))
{
editMenu.setVisible(true);
}
else {
JOptionPane.showMessageDialog(this, "Incorrect Password");
teacherPasswordField.setText("");
teacherPasswordField.requestFocus();
editMenu.setVisible(false);
}
} //when the user selects this menu item it will bring up a JFileChooser allowing the user toselect the text file that they want to study.
-
8/2/2019 IB Program Dossier Template1
30/94
Lastname IB Candidate 693085 page 30
//private voidseventhGradeRootsMenuItemActionPerformed(java.awt.event.ActionEvent evt) { // the JFile CHooser allows the user to select the specificdocument that they want to study
// JFileChooser fileChooser = new JFileChooser(); // this sets a new directory so that the JFileChooser only brings
//up the files the program uses
String userDir = System.getProperty("user.dir") ;
File curDir = new File(userDir + "/Vocabulary/roots");
fileChooser.setCurrentDirectory(curDir);
fileChooser.showOpenDialog(this);
String filename = fileChooser.getSelectedFile().getAbsolutePath();
readFile(filename);
DisplayRootsMethod();
}
//This is the same thing as the roots menu item except that it displays the wordstext files not the root text files with the JFileChooser. Then it displays the wordsto the user by the display words method.
//private voidseventhGradeWordsMenuItemActionPerformed(java.awt.event.ActionEvent evt) { // the JFile Chooser allows the user to select the specificdocument that they want to study
//JFileChooser fileChooser = new JFileChooser();
// this sets a new directory so that the JFileChooser only brings
//up the files the program uses
String userDir = System.getProperty("user.dir") ;
File curDir = new File(userDir + "/Vocabulary/words");
fileChooser.setCurrentDirectory(curDir);
-
8/2/2019 IB Program Dossier Template1
31/94
Lastname IB Candidate 693085 page 31
fileChooser.showOpenDialog(this);
String filename = fileChooser.getSelectedFile().getAbsolutePath();
readFile(filename);
DisplayWordsMethod();
} //this menu item does the same thing as seventh grade roots. It brings up a JFile Chooserallowing the user to select the file they want to study. It then displays the roots out to theuser using the display roots method.
//private voideighthGradeRootsMenuItemActionPerformed(java.awt.event.ActionEvent evt) { // the JFileChooser allows the user to select the specific documentthat they want to study
//JFileChooser fileChooser = new JFileChooser();
// this sets a new directory so that the JFileChooser only brings
//up the files the program uses
String userDir = System.getProperty("user.dir") ;
File curDir = new File(userDir + "/Vocabulary/words");
fileChooser.setCurrentDirectory(curDir);fileChooser.showOpenDialog(this);
//JFileChooser fileChooser = new JFileChooser();
String filename = fileChooser.getSelectedFile().getAbsolutePath();
readFile(filename);
DisplayRootsMethod();
} //This is the same thing as the roots menu item except that it displays the wordstext files not the root text files with the JFileChooser. Then it displays the wordsto the user by the display words method.
-
8/2/2019 IB Program Dossier Template1
32/94
Lastname IB Candidate 693085 page 32
//private voideighthGradeWordsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
// the JFile CHooser allows the user to select the specific document that
they want to study //JFileChooser fileChooser = new JFileChooser();
// this sets a new directory so that the JFileChooser only brings
//up the files the program uses
String userDir = System.getProperty("user.dir") ;
File curDir = new File(userDir + "/Vocabulary/words");
fileChooser.setCurrentDirectory(curDir);
fileChooser.showOpenDialog(this);
//JFileChooser fileChooser = new JFileChooser();
//this reads the selected file and displays it out to the user
String filename = fileChooser.getSelectedFile().getAbsolutePath();
readFile(filename);
DisplayRootsMethod();
}
//This is the same thing as the roots menu item except that it displays the wordstext files not the root text files with the JFileChooser. Then it displays the wordsto the user by the display words method.
-
8/2/2019 IB Program Dossier Template1
33/94
Lastname IB Candidate 693085 page 33
//private voidninthGradeWordsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
// the JFile CHooser allows the user to select the specific document that
they want to study //JFileChooser fileChooser = new JFileChooser();
// this sets a new directory so that the JFileChooser only brings
//up the files the program uses
String userDir = System.getProperty("user.dir") ;
File curDir = new File(userDir + "/Vocabulary/words");
fileChooser.setCurrentDirectory(curDir);
fileChooser.showOpenDialog(this);
//JFileChooser fileChooser = new JFileChooser();
String filename = fileChooser.getSelectedFile().getAbsolutePath();
readFile(filename);
DisplayWordsMethod();
} //this menu item does the same thing as seventh grade roots. It brings up a JFile Chooserallowing the user to select the file they want to study. It then displays the roots out to theuser using the display roots method.
-
8/2/2019 IB Program Dossier Template1
34/94
Lastname IB Candidate 693085 page 34
//private voidninthGradeRootsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
// the JFile CHooser allows the user to select the specific document that
they want to study //JFileChooser fileChooser = new JFileChooser();
// this sets a new directory so that the JFileChooser only brings
//up the files the program uses
String userDir = System.getProperty("user.dir") ;
File curDir = new File(userDir + "/Vocabulary/roots");
fileChooser.setCurrentDirectory(curDir);
fileChooser.showOpenDialog(this);
//JFileChooser fileChooser = new JFileChooser();
String filename = fileChooser.getSelectedFile().getAbsolutePath();
readFile(filename);
DisplayRootsMethod();
} //This method displays the information from the text file out to the user in the radiobuttons
-
8/2/2019 IB Program Dossier Template1
35/94
Lastname IB Candidate 693085 page 35
public void DisplayRootsMethod(){
//JFileChooser fileChooser = new JFileChooser();
//fileChooser.getSelectedFile();
//String userDir = System.getProperty("user.dir") ;
//File curDir = new File(userDir + "/Vocabulary/roots");
//fileChooser.setCurrentDirectory(curDir);
// this uses a random to pull random questions out of my text file
int rand;
Random random = new Random();
rand = random.nextInt(roots.size());
root r = roots.get(rand);
//this creates an array that holds th einforamtion from my text files
String[] data = new String[5];
data[0] = r.getcorrectAnswer();
data[1] = r.getotherAnswers1();
data[2] = r.getotherAnswers2();
data[3] = r.getotherAnswers3();
data[4] = r.getquestion();
//rand = random.nextInt(data.length -1);
//this displays the data from the array out to the user in the correct text fields
questionsRadioButton4.setText(data[3]);
-
8/2/2019 IB Program Dossier Template1
36/94
Lastname IB Candidate 693085 page 36
questionRadioButton1.setText(data[1]);
questionsRadioButton2.setText(data[2]);
questionsRadioButton3.setText(data[0]);
questionLabel.setText(data[4]);
} //this does the same thing as the roots except that it displays the variables of words to theproper place (label or a radio button).
-
8/2/2019 IB Program Dossier Template1
37/94
Lastname IB Candidate 693085 page 37
public void DisplayWordsMethod(){
// this uses a random to pull random questions out of my text file
int rand;
Random random = new Random();
rand = random.nextInt(words.size());
word w = words.get(rand);
//this creates an array that holds th einforamtion from my text files
String[] data = new String[5];
data[0] = w.getcorrectAnswer();
data[1] = w.getotherAnswers1();
data[2] = w.getotherAnswers2();
data[3] = w.getotherAnswers3();
data[4] = w.getquestion();
//rand = random.nextInt(data.length -1);
//this displays the data from the array out to the user in the correct text fields
questionLabel.setText(data[4]);
questionRadioButton1.setText(data[1]);
questionsRadioButton2.setText(data[2]);
questionsRadioButton3.setText(data[0]);
questionsRadioButton4.setText(data[3]);
}
Word:
-
8/2/2019 IB Program Dossier Template1
38/94
Lastname IB Candidate 693085 page 38
public class word {
private String question;
private String correctAnswer;
private String otherAnswers1;
private String otherAnswers2;
private String otherAnswers3;
public word(){}
public word(String q, String c, String o, String h, String t)
{
question = q;
correctAnswer = c;
otherAnswers1 = o;
otherAnswers2 = h;
otherAnswers3 = t;
}
public void setquestion(String q)
{
question = q;
}
public String getquestion()
{
return question;
}
public void setcorrectAnswer(String c)
-
8/2/2019 IB Program Dossier Template1
39/94
Lastname IB Candidate 693085 page 39
{
correctAnswer = c;
}
public String getcorrectAnswer()
{
return correctAnswer;
}
public void setotherAnswers1(String o)
{
otherAnswers1 = o;
}
public String getotherAnswers1()
{
return otherAnswers1;
}
public void setotherAnswers2(String h)
{
otherAnswers2 = h;
}
public String getotherAnswers2()
{
return otherAnswers2;
}
public void setotherAnswers3(String t)
-
8/2/2019 IB Program Dossier Template1
40/94
Lastname IB Candidate 693085 page 40
{
otherAnswers3 = t;
}
public String getotherAnswers3()
{
return otherAnswers3;
}
}
Root:
//public class root {private String question;private String correctAnswer;private String otherAnswers1;private String otherAnswers2;private String otherAnswers3;
public void root(){}
public void root(String q, String c, String o, String h, String t){
question = q;correctAnswer = c;otherAnswers1 = o;otherAnswers2 = h;otherAnswers3 = t;
}
public void setquestion(String q){question = q;}
public String getquestion(){return question;}
public void setcorrectAnswer(String c){correctAnswer = c;}
-
8/2/2019 IB Program Dossier Template1
41/94
Lastname IB Candidate 693085 page 41
public String getcorrectAnswer(){return correctAnswer;}
public void setotherAnswers1(String o){otherAnswers1 = o;}
public String getotherAnswers1(){return otherAnswers1;}
public void setotherAnswers2(String h){otherAnswers2 = h;
}public String getotherAnswers2(){return otherAnswers2;
}public void setotherAnswers3(String t)
{otherAnswers3 = t;
}public String getotherAnswers3()
{return otherAnswers3;
} //}Update Roots Dialog:
import java.io.File;import java.util.ArrayList;import java.util.Random;import javax.swing.JFileChooser;
// /*
//* To change this template, choose Tools | Templates //* and open the template in the editor. //*/
// /* //* updateRootsDialog.java //* //* Created on Feb 17, 2011, 1:20:31 PM
-
8/2/2019 IB Program Dossier Template1
42/94
Lastname IB Candidate 693085 page 42
//*/
// /** //* //* @author 693085
//*/ //public class updateRootsDialog extends javax.swing.JDialog {//Global Variables
ArrayList roots = new ArrayList(); //UpdateDialog updateDlg = new UpdateDialog(this, true);
// initComponents();
}
private void
saveButtonActionPerformed(java.awt.event.ActionEvent evt) {writeToFile();
//readFile(filename); //displays the changed variables back out to the user.
displayNamesToList(); //clears all the text fields and puts the cursor back into the first text fieldquestionTextField.setText("");correctAnswerTextField.setText("");otherAnswer1TextField.setText("");otherAnswers2TextField.setText("");otherAnswer3TextField.setText("");
questionTextField.requestFocus();}
//this is where the user decides which text file they want to modify, using a jFileChooser //to select the text file they wantprivate voidchooseTextFileMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
String userDir = System.getProperty("user.dir") ;File curDir = new File(userDir + "/Vocabulary/roots");fileChooser.setCurrentDirectory(curDir);fileChooser.showOpenDialog(this);filename = fileChooser.getSelectedFile().getAbsolutePath();readFile(filename);
//displays the information back out to the userDisplayToList();
}
//This button adds new roots to the word list so the user can permanently changethe text //files and adjust to a changing curriculum
-
8/2/2019 IB Program Dossier Template1
43/94
Lastname IB Candidate 693085 page 43
// private voidaddRootButtonActionPerformed(java.awt.event.ActionEvent evt ) {
// // TODO add your handling code here:
//Taking the information the user puts in the text fields and setting them as
//new string ValuesString q = questionTextField.getText();String c = correctAnswerTextField.getText();String o = otherAnswer1TextField.getText();String h = otherAnswers2TextField.getText();String t = otherAnswer3TextField.getText();
//making a new object root with the information from the user //and adding it to the roots ArrayListroot r = new root(q,c,o,h,t);roots.add(r);
//displaying the information back out to the user via the rootList // and clearing the text fieldsDisplayToList();questionTextField.setText("");correctAnswerTextField.setText("");otherAnswer1TextField.setText("");otherAnswers2TextField.setText("");otherAnswer3TextField.setText("");questionTextField.requestFocus();
} //This is where the user selects a current root in the text file and modifies itprivate voidrootsListValueChanged(javax.swing.event.ListSelectionEvent evt) {
// TODO add your handling code here: //Using a rand because it is convenient to get the data.
int rand = rootsList.getSelectedIndex(); //Random random = new Random(); //rand = random.nextInt(roots.size()); //error cheking to make sure that the int does not equal -1if (rand >= 0)
{
root r = roots.get(rand); //creating a new array that takes the information from the objects in the text file
//set them as a new array data.String[] data = new String[5];data[0] = r.getcorrectAnswer();data[1] = r.getotherAnswers1();
-
8/2/2019 IB Program Dossier Template1
44/94
Lastname IB Candidate 693085 page 44
data[2] = r.getotherAnswers2();data[3] = r.getotherAnswers3();data[4] = r.getquestion();
// taking the new array data and using it to set the text fields to the correct string //value in the corresponding text field
questionTextField.setText(data[4]);correctAnswerTextField.setText(data[0]);otherAnswer1TextField.setText(data[1]);otherAnswers2TextField.setText(data[2]);otherAnswer3TextField.setText(data[3]);
//this changes the list value to whatever the user put into the text fields
questionTextField.setText(roots.get(rootsList.getSelectedIndex()).getquestion());correctAnswerTextField.setText(""+
roots.get(rootsList.getSelectedIndex()).getcorrectAnswer());
otherAnswer1TextField.setText(""+roots.get(rootsList.getSelectedIndex()).getotherAnswers1());
otherAnswers2TextField.setText(roots.get(rootsList.getSelectedIndex()).getotherAnswers2());
otherAnswer1TextField.setText(roots.get(rootsList.getSelectedIndex()).getotherAnswers3());
}
}
private voidclearButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:questionTextField.setText("");correctAnswerTextField.setText("");otherAnswer1TextField.setText("");otherAnswers2TextField.setText("");otherAnswer3TextField.setText("");questionTextField.requestFocus();
}
private voidexitButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:this.dispose();
}
-
8/2/2019 IB Program Dossier Template1
45/94
Lastname IB Candidate 693085 page 45
//this button clears all the text fields and puts the cursor in the questions textField
private voidclearButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:questionTextField.setText("");correctAnswerTextField.setText("");otherAnswer1TextField.setText("");otherAnswers2TextField.setText("");otherAnswer3TextField.setText("");questionTextField.requestFocus();
}
private voiddeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {
// // TODO add your handling code here:
index = rootsList.getSelectedIndex(); //delete the element from the array list using the remove() methodroots.remove(index);
//update the display listtry{
DisplayToList();}catch(Exception ex){}
//select another element to display to the UIif(roots.size() > 0 ){if(index > roots.size())
rootsList.setSelectedIndex(index);else
rootsList.setSelectedIndex(index-1);}
}
public void linkRootArray(ArrayList r){
roots = r;}
public void setIndex(int i){
index = i;root r = roots.get(index);questionTextField.setText(r.getquestion());
-
8/2/2019 IB Program Dossier Template1
46/94
Lastname IB Candidate 693085 page 46
correctAnswerTextField.setText(r.getcorrectAnswer());otherAnswer1TextField.setText(r.getotherAnswers1());otherAnswers2TextField.setText(r.getotherAnswers2());otherAnswer3TextField.setText(r.getotherAnswers3());
}
private void writeToFile(){ // fileChooser = new JFileChooser(); // String userDir = System.getProperty("user.dir"); // File curDir = new File(userDir + "/Vocabulary/roots");
//fileChooser.getSelectedFile();
// String dir = System.getProperty("user.dir"); //Readfile rf = new Readfile(dir + "\\Elements.txt");
//rewriting the original textFile that the user selects
writeFile wf = new writeFile(filename);for(int i = 0; i < roots.size(); i ++){String outputData = "";
//root r = roots.get(i);if(i = = rootsList.getSelectedIndex()){
//this gets the new data put in by the user in the textFieldsoutputData = questionTextField.getText() + "," +
correctAnswerTextField.getText() + ","+ otherAnswer1TextField.getText() + "," +
otherAnswers2TextField.getText() + "," +
otherAnswer3TextField.getText();}else {
// this gets all the objects in the text fileroot r = roots.get(i);outputData = r.getquestion() + "," + r.getcorrectAnswer() + "," +
r.getotherAnswers1()+ "," + r.getotherAnswers2() + "," + r.getotherAnswers3();
} //this rewrites the whole text file
wf.write(outputData);}
wf.close();}
//this method displays all the question variable for the objects in the roots Arraylist //that the user selects to the rootsList box for the user to view
-
8/2/2019 IB Program Dossier Template1
47/94
Lastname IB Candidate 693085 page 47
private void DisplayToList(){
String[] root = new String[roots.size()];
for(int i = 0; i < roots.size(); i++)
{ root[i] = roots.get(i).getquestion();}rootsList.setListData(root);
}
private void displayNamesToList(){
String[] newRoot = new String[roots.size()];
for(int i = 0; i < roots.size(); i++){newRoot[i] = roots.get(i).getquestion();
}
rootsList.setListData(newRoot);}
-
8/2/2019 IB Program Dossier Template1
48/94
Lastname IB Candidate 693085 page 48
-
8/2/2019 IB Program Dossier Template1
49/94
Lastname IB Candidate 693085 page 49
-
8/2/2019 IB Program Dossier Template1
50/94
Lastname IB Candidate 693085 page 50
-
8/2/2019 IB Program Dossier Template1
51/94
Lastname IB Candidate 693085 page 51
-
8/2/2019 IB Program Dossier Template1
52/94
Lastname IB Candidate 693085 page 52
-
8/2/2019 IB Program Dossier Template1
53/94
Lastname IB Candidate 693085 page 53
-
8/2/2019 IB Program Dossier Template1
54/94
Lastname IB Candidate 693085 page 54
-
8/2/2019 IB Program Dossier Template1
55/94
Lastname IB Candidate 693085 page 55
-
8/2/2019 IB Program Dossier Template1
56/94
Lastname IB Candidate 693085 page 56
-
8/2/2019 IB Program Dossier Template1
57/94
Lastname IB Candidate 693085 page 57
-
8/2/2019 IB Program Dossier Template1
58/94
Lastname IB Candidate 693085 page 58
-
8/2/2019 IB Program Dossier Template1
59/94
Lastname IB Candidate 693085 page 59
-
8/2/2019 IB Program Dossier Template1
60/94
Lastname IB Candidate 693085 page 60
-
8/2/2019 IB Program Dossier Template1
61/94
Lastname IB Candidate 693085 page 61
-
8/2/2019 IB Program Dossier Template1
62/94
Lastname IB Candidate 693085 page 62
-
8/2/2019 IB Program Dossier Template1
63/94
Lastname IB Candidate 693085 page 63
-
8/2/2019 IB Program Dossier Template1
64/94
Lastname IB Candidate 693085 page 64
-
8/2/2019 IB Program Dossier Template1
65/94
Lastname IB Candidate 693085 page 65
Criteria C2: Handling errors
Error Handling
//Using an if statement to make sure the program only runs unless rand is greaterthan or equal to 0. Preventing a -1 exception.
if (rand >= 0)
{
root r = roots.get(rand);
//creating a new array that takes the information from the objects inthe text file
//set them as a new array data.
String[] data = new String[5];
data[0] = r.getcorrectAnswer();
data[1] = r.getotherAnswers1();
data[2] = r.getotherAnswers2();
data[3] = r.getotherAnswers3();
data[4] = r.getquestion();
// taking the new array data and using it to set the text fields to thecorrect string
//value in the corresponding text field
questionTextField.setText(data[4]);correctAnswerTextField.setText(data[0]);
otherAnswer1TextField.setText(data[1]);
otherAnswers2TextField.setText(data[2]);
-
8/2/2019 IB Program Dossier Template1
66/94
Lastname IB Candidate 693085 page 66
otherAnswer3TextField.setText(data[3]);
//this changes the list value to whatever the user put into the textfields
questionTextField.setText(roots.get(rootsList.getSelectedIndex()).getquestion());
correctAnswerTextField.setText(""+roots.get(rootsList.getSelectedIndex()).getcorrectAnswer());
otherAnswer1TextField.setText(""+roots.get(rootsList.getSelectedIndex()).getotherAnswers1());
otherAnswers2TextField.setText(roots.get(rootsList.getSelectedIndex()).getotherAnswers2());
otherAnswer1TextField.setText(roots.get(rootsList.getSelectedIndex()).getotherAnswers3());
}
Using a try catch statement to prevent the program from using wronginfo.
try{
DisplayToList();
}catch(Exception ex){}
Using an if statement to make check that the password the user put in is thesame one that the program has put into it as the correct password. If not than amessage appears telling the user that an incorrect password has been put in andwhen the user selects ok the password field is cleared and the cursor set at thebeginning.
if(questionsRadioButton4.getText().equals(correctPassword))
-
8/2/2019 IB Program Dossier Template1
67/94
Lastname IB Candidate 693085 page 67
{
JOptionPane dlg = new JOptionPane();
dlg.showMessageDialog(this, " Yay! " +
questionsRadioButton4.getText() + " is correct");answerLabel.setText(" Yay! " +
questionsRadioButton4.getText() + " is correct");
}
else
{//displaying a message that the user has chosen the wronganswer and displaying it to a text Label for the users reference.
JOptionPane dlg = new JOptionPane();
dlg.showMessageDialog(this, " Wrong! " +questionsRadioButton4.getText() + " is wrong");
answerLabel.setText(" wrong! " +questionsRadioButton4.getText() + " is wrong");
}
-
8/2/2019 IB Program Dossier Template1
68/94
Lastname IB Candidate 693085 page 68
Criteria C3: Success of the program
Evidence that the program met all the objectives from A2
-
8/2/2019 IB Program Dossier Template1
69/94
Lastname IB Candidate 693085 page 69
Stage D Documentation
-
8/2/2019 IB Program Dossier Template1
70/94
Lastname IB Candidate 693085 page 70
Criteria D1: Including an annotated hard copy of the test output
Annotated sample of all tests for the criteria in A2
This is the opening screen that the user sees. It has so much open space so that all of thedefinitions of the answers can be fully displayed to the user.
Here the teachers can click the teacher radio button which will make the teacherpassword field appear so they can enter their password.
-
8/2/2019 IB Program Dossier Template1
71/94
Lastname IB Candidate 693085 page 71
The teachers then enter their password into the encrypted text field. When they hit enter if the password does not match the password set in the program then a message dialog popsup looking like the one below.
when the user hits ok the program will return the cursor to the password field. The editmenu item will not be displayed. However if the password does match the password setin the program then the edit menu item will be set visible as shown below.
-
8/2/2019 IB Program Dossier Template1
72/94
Lastname IB Candidate 693085 page 72
After clicking on the edit menu an update menu item will appear. When the menuitem is clicked the update roots and update words buttons will appear as shownbelow.
Here the teachers can decide whether to update the roots text files or the wordtext files. Either option will bring up basically the same thing with different text fileoptions. When the user clicks on update roots it brings up a update dialog box asshown below.
-
8/2/2019 IB Program Dossier Template1
73/94
Lastname IB Candidate 693085 page 73
Here the user can update specific text files by clicking on the file menu bar andselecting whatever text file the want to modify.
-
8/2/2019 IB Program Dossier Template1
74/94
Lastname IB Candidate 693085 page 74
The choose text file will bring up a Jfile chooser as shown below where the usercan select which text files they want to modify.
-
8/2/2019 IB Program Dossier Template1
75/94
Lastname IB Candidate 693085 page 75
When the user clicks open that opens the text file that was selected and displaysthe question or roots part of the object to the roots list for the user to view asshown
-
8/2/2019 IB Program Dossier Template1
76/94
Lastname IB Candidate 693085 page 76
below.
If the user selects a certain root the program will display all parts of that objectroot to the appropriate text fields for the user to view and change if necessary.
-
8/2/2019 IB Program Dossier Template1
77/94
Lastname IB Candidate 693085 page 77
This demonstrates displaying the root selected to the appropriate text fields forthe user to change and modify as needed.
-
8/2/2019 IB Program Dossier Template1
78/94
Lastname IB Candidate 693085 page 78
The user can then go in and change the root. Once they click on the save changes buttonthe program will rewrite the whole file that the user selected with the proper changes thathave been made. It will also clear the text Fields as shown below.
-
8/2/2019 IB Program Dossier Template1
79/94
Lastname IB Candidate 693085 page 79
The user can also add new roots to the text file by filling in the appropriate text fieldswith the information. The user than clicks on add root after the information has been putinto the text fields.
-
8/2/2019 IB Program Dossier Template1
80/94
Lastname IB Candidate 693085 page 80
The program then clears the text fields and displays the new word out to the user via theroots list box.
-
8/2/2019 IB Program Dossier Template1
81/94
Lastname IB Candidate 693085 page 81
The user can then do the same thing with any of the roots previously choosen and displaythe information to the text fields. When the user hits delete, the program deletes whatever
-
8/2/2019 IB Program Dossier Template1
82/94
Lastname IB Candidate 693085 page 82
root is currently selected. In this case qwerty was deleted as shown below.
-
8/2/2019 IB Program Dossier Template1
83/94
Lastname IB Candidate 693085 page 83
-
8/2/2019 IB Program Dossier Template1
84/94
Lastname IB Candidate 693085 page 84
-
8/2/2019 IB Program Dossier Template1
85/94
Lastname IB Candidate 693085 page 85
For students when they click on the student radio button all the edit things are setvisible to false so that students cant go in and mess with the text files.
Now the only option that students have is to go to file menu and select which setof roots or words that they want to study.
-
8/2/2019 IB Program Dossier Template1
86/94
Lastname IB Candidate 693085 page 86
The roots and words are broken up by grade so the students can choose to select whichever one they want to study and then that brings up a jFileChooser. As shown below.
-
8/2/2019 IB Program Dossier Template1
87/94
Lastname IB Candidate 693085 page 87
This allows students to select which text file they want to practice each week ofroots is displayed along with a all roots text file so the students can practice all ofthe roots for that year.
Once the file is selected and the student hits open, the program will automaticallydisplay the one of the roots randomly chosen out of the file they selected to the
-
8/2/2019 IB Program Dossier Template1
88/94
Lastname IB Candidate 693085 page 88
correct place. The answers to the radio buttons and the question or root to thequestion Label.
Once a radio button is selected the computer will display a message dialog telling themwhether they got it right or wrong.
When the student gets an answer correct the program will display a message dialog boxlike this one. This will then be put into the answer label and will only disappear when thenext question is answered.
-
8/2/2019 IB Program Dossier Template1
89/94
Lastname IB Candidate 693085 page 89
-
8/2/2019 IB Program Dossier Template1
90/94
-
8/2/2019 IB Program Dossier Template1
91/94
Lastname IB Candidate 693085 page 91
select different update dialogs to edit both roots and words. However actually updatingthe data is pretty quick and easy for the user to do. For example once they select a textfile the words or roots in that particular text file are displayed to the user in a list box.This makes it easy for them to select certain roots or words and modify them.
Loading files was very easy and quick because none of the files are that big (rangingfrom 101 bytes to 8.69KB max).The program automatically displays the words or roots inthat particular text file out to the user to view, which is very quick and convenient
because other than selecting the text file the user doesnt have anything else they need todo to access the information.
Im sure there was a more efficient way to display the ans wers out to the user but Icouldnt get anything else to work. Using if statements ensured that at least the studentswould select the correct answer and the correct answer is displayed for them until theyanswer the next question.
Improvements:There are many possible improvements to this program. The main one would be to have arand generate 4 random numbers and use if statements to tell the program when to set thevarious question radio buttons to the answers from the text files.Ex. //if the random number generated is equal to 1 then the program will display thevariables from the object in the text files to the appropriate places.
if (rand = = 1){
questionLabel.setText(r.getquestion());questionRadioButton1.setText(r.getotherAnswers1());questionsRadioButton2.setText(r.getotherAnswers2());questionsRadioButton3.setText(r.getcorrectAnswer());questionsRadioButton4.setText(r.getotherAnswers3());
}This would be done for each random number generated in this case 4 (one for each question radio
button that needs to display answers). This way the same answers dont appear in the same order every time the students go to study.
Another improvement would be to consolidate the update dialogs so that the user can save timeand effort by being able to update everything all at once, instead of having to go to two differentplaces to update roots or update words. This would also save a ton of code because both updatedialogs basically use the same code it is just changed around to roots instead of words or viceversa.
Alternate approaches:
One alternate approach would be to consolidate the code to one mainUI form whichwould certainly take less of the users time to navigate and make the program moreefficient. However it would make debugging much longer, since the program would begoing through larger chunks of code.
-
8/2/2019 IB Program Dossier Template1
92/94
Lastname IB Candidate 693085 page 92
Originally I had thought that I would just make one Dialog form for the teachers to editthe text files and I still think that way would be much more user friendly and save a lot of time for the teachers. By saving the teachers time it would make the program much moreappealing for the user. However the condensed form would leave much more room for
errors and make debugging harder.
The code could have changed a lot, by using different variables; I used the ones that Ithought were the easiest and most convenient at the time. But these could changedepending on the coders or users preference.
-
8/2/2019 IB Program Dossier Template1
93/94
Lastname IB Candidate 693085 page 93
Stage E Holistic approach
-
8/2/2019 IB Program Dossier Template1
94/94
Criteria E: Holistic approach to the dossier
Documentation of Mastery items