Skip to content
Question paper and memo

Information Technology Grade 10 P1 KZN June 2015 Paper & Memo

Grade 10 Information Technology Paper 1 question paper and memo from the KZN June Exam 2015, 16 pages. Read online or get the free PDF download.

Subject: Information TechnologyGrade 10201516 pages
Download

Loading document…

Loading document…

Document textSearch extracted text and jump to a page.
EXAMINER: M PADAYACHEE Downloaded from hlayiso.com basic education Department: Basic Education REPUBLIC OF SOUTH AFRICA JUNE EXAMINATION 2015 INFORMATION TECHNOLOGY P11 GRADE 10 MODERATOR: $ NAIDOO DURATION: 2HRS DATE: 12 — 06 ~- 2015 MARKS: 100 INSTRUCTIONS TO LEARNERS: YN Ensure that this paper contains 7 pages and 3 questions. Answer all questions. Save your work at every 10 minute interval. Ensure that your work is being saved in the folder you are going to submit for marking. Take heed of the time stipulation for each question. Follow it to avoid incomplete answers. Check your exam folder and ensure that you have the following files : e A Netbeans project called June2015G10 that contains: o A package called JunePac o A frame class called Q2Frame o A frame class called RatingFrame. Insért your name in the first line of every class. Page 1 of 7
Downloaded from hlayiso.com SCENARIO Your school as commissioned you as the IT learner to help manage the media centre. The media centre offers services to the learners and the teachers as follows: > Borrowing and returning to library books and educational DVD's. > Use of the internet per time. : > Photocopying and printing. QUESTION ONE [SCRATCH PROGRAMMING] ~ 40 Minutes The media centre requires each learner to have a code which is a randomly generated seven digit code. This code when entered by the user must be tested. Open the application in Scratch called Quest1. You will find that there are four sprites created. Complete the script to validate the code entered by the user as requested below: © Two lists have been created for you. You are required to declare all other variables that you may need to complete the application. Hint: Study this script isan example to help solve the problem. 1.1. The sprite on the left(Input Sprite) should accept the data from the table below and store it in the required lists. You should only enter the details for the number of names suggested by the user. Do not enter the entire table. The capturer should ask the user to enter the number of names he wants to test, followed by the name list and the code list. Program the sprite using loops to populate the respective lists with the data from the table as specified by the user. (10) NAME CODE Rodanne 1232414 René 3147238 _| Preleen 8365389 Trevor 4236891 Réann 7642531 Jonathan 5627819 Page 2 of 7
Downloaded from hlayiso.com 1.2. Write the scripts for the respective sprites that will validate the codes in the given list. 1.2.4. The second sprite (on the right) helps in the validation process by doing the following: Extracts the middle number from the code list. * Determines if the number is prime or not and sets a variable called “prime” to equal to “true” or “false” respectively. (12) 1.2.2. The third sprite will also assist the validation process by: “Extracting every value in an even index position and accumulate a sum for these values. “The sum of the first and the last digits in the code must also be added. + It then checks to see if the two sums are the same and assigns the value “true” if they are or “false” if they are not. (10) 1.2.3. The last sprite simply displays the following: ** The name of the person entered, the code entered for that person and the “Valid” or “Invalid” according to the results e.g. of output: Rodanne , 1232414 , VALID! (4) Use the picture of the scratch code: Hey guys! Im Hello im Testing the sums. HiT am the Input Guy! Hilm testing the [4 prime for you! [36] Page 3 of 7
Downloaded from hlayiso.com : QUESTION TWO [JAVA PROGRAMMING] 40 minutes You are requested to develop apps to assist in the management of the media centre. The first app that your help is required in is the app designed by the learners to aid the process of calculating charges for the photocopier. The school has a pricing system based on the grades and the number of copies made, for each learner and teacher that may use the system. Educators will only pay for colour copies as stated below. The learners will pay as follows: GRADE 8 AND 9 © 50c per copy for <=15 copies An additional 30c is charged for every copy more than 15 *For every copy more than 50copies, an additional R1 is charged. GRADE 10 AND 11 ©80c for every copy <=25 copies. *Additional 50c per copy for more than 25 copies #R1,20 is charged for every copy over 50 copies GRADE 12 The first 15 copies is free ( ) *From 16 to 35 copies, a charge of R1.10 is charged per copy *An additional cost of 50c per copy is charged for copies above 35 Nb. Each colour copy costs R4 per colour copy. Colour copies are only made for teachers. Open the project June2015G10 and execute the Q1Frame. The program has no functionality. insert your name as a comment in the first line of each class. Study the GUI below and complete the code for the respective buttons and components. 2.1. Program the components in the Data Entry panel as follows: 2.1.1. Format the jPanel3 to a border entitled Quotation. (3) 2.1.2. Set the spinner in the from 0 to 100, type integer, using the properties window. (3) 2.1.3. Set the combo box to select the grade(8 ~ 13) as integers. (3) 2.1.4, Initialise the radio buttons into the same group. (3) 2.1.5. Place a title at the top of jPanel1 that reads: “Photocopy Application” (3) Page 4 of 7
Downloaded from hlayiso.com 2.2. Declare the global variables for the following data entries in the Q1Frame class. (3) Name of Identifier Type Description numCopies. Integer value | The number of copies made by the client — accessed from spinner ger Integer A value in the range 8 to 13 — combo box selection. Nb. 13 represents a teacher name Text The name of the client —jTextfield numBlack Integer The number of black copies made — jTextfield numCol Integer The number of colour copies. 2.3, Write code, for the CAPTURE DATA button in the Data Entry panel, that assigns the values upon entry to the global variables. Note: ¥ The number for colour must be entered only if Colour radio button is selected. v If Black/White is selected, the number is taken from the text field on the top. v Ifa learner selects a colour photocopy, display a suitable message to ask them to reselect. 2.4, Program the PROCESS button to calculate the price that the client must pay. Take note of the following: > Teachers will only pay for colour copies. Black and white copies are free for teachers. Therefore the number of copies for teachers will be for colour only. Use the sample run below: a ae 3 = ea JA Auote 5 = a He ieeges tty NANE MR Naldoo See ee Sa TEACHER = a NUM of Slack Copies NUM of Colnur Copies 5 PRICE 720.00 MR Diaidoo Page 5 of 7
Downloaded from hlayiso.com [ : 3 : (aoe, 2) = NAME Peter = GRADE tf be NUM of Black Copies 3 NUtotGolourCopies 0 noes) PRICE R240 Peter (8) 2.5. Program the Print Quote button in the Quotation panel to display the output as shown in the sample run. _ (5) NAME nilel TEACHER NUM of Black Copies 2 NURl of Colour Copies 3 PRICE, sR20,00 [40] QUESTION THREE [40 minutes] Learners who use the Internet have to be given a rating category. Each learner-is given a code which is made up of their Last name and four digits e.g. “Pillay8540”. The four digit code consists of: > The number of times the person used the internet out of 100, i.e. the first two digits. This must be a two digit number. > The second two digits is a randomly generated number from ten to ninety nine. 3.1. You are required to complete the application that allows the user to enter his/her last name and the number of times they used the internet as a single string e.g. “Pillay85”, Then you should join the randomly generated number to the other input e.g. “Pillay8540” where 40 is generated. Form the code and display it in the appropriate textfield given. (8) 3.2. The rating of the learner depends on the first two digits after the last name. The rating is worked out as follows: Value Rating 0<=Value<30 D 30<=Value<50 c 50<=Value<70 B 70<=Value<=100 A Page 6 of 7
Downloaded from hlayiso.com Study the GUI frame called RatingFrame and complete the code as requested and program the GET RATING!! button. = a MoodleyS731 a { | | o) 67 is rating 3 3.2.1. Use the code formed to extract the number of times the internet was used. (4) 3.2.2. Use the of times to determine the rating(assume the number of times represents a %) according to the rating table given above. (12) [24] TOTAL Pi = 100 PY SCHOOL DEPARTMET | © S & SCIENCES, PALLAY HO. Ly ( ; ) 4 pac ees conn ‘ anmmsananserafay tarpesesbazeewen sees, : ip b wl i Page 7 of 7
Downloaded from hlayiso.com
a Grl0 ca Downloaded from hlayiso.com Paper! MEMO 2 *To change this template, choose Tools | Templates 3 * and open the template in the editor. 4" 5 package JunePac; 6 7 import javax.swing.JOptionPane; 8 gr 10 * 11 * @author comp13 12° 13 import java.text.*; 14 public class Q2Frame extends javax.swing. JFrame { 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 61 pe * Creates new form Q1Frame 4 private int numCopies; private int numBlack; private int numCol; private int gr; private String name; private double price =.0.00; DecimalFormat d = new DecimalFormat("0.00"); public Q2Frame() { initComponents(); this,setLocationRelativeTo(null}; this.setTitle("Photocopy Application"); } ras * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Cade"> private void initComponents() { buttonGroup1 = new javax.swing.ButtonGroup(); jLabelS = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jSpinnert = new javax.swing.JSpinner(); jLabel2 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox(); jPanel4 = new javax.swing.JPanel(); jRadioButtorit = new javax.swing.JRadioButton(); jRadioButton2 = new javax.swing.JRadioButton(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabei(); jTextField1 = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax,swing.JButton(); jPanel3 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JSerollPane(); jTextAreat = new javax.swing.JTextArea(); jButton3 = new javax.swing. JButton(); 1.1 of 8 Quest2 ECONDARY SCHOQL OF MATHS & SCIENCES OD. MIR L PILLAY 2015.06.08 12:36:55
Downloaded from hlayiso.com . Grl0 Paper! MEMO Quest2 62 63 jLabel5.setText("jLabel5"); 64 65 setDefaultCloseOperation(javax.swing. WindowConstants.EXIT_ON_CLOSE); 66 67 jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Data Entry", javax.swing.border.TitledBorder. CENTER, javax.swing.border.TitledBorder. DEFAULT_POSITION)), 68 69 jLabel1.setText("Number of Copies"); 70 71 jSpinnert.setModel(new javax.swing.SpinnerNumberModel(0, 0, 109, 1), 72 73 jLabel2.setText("GRADE’), 74 75 jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[j {"8", "9", "10", waa" "42", 43"); 76 77 jPanel4.setBo! rder(javax.swing. BorderFactory.createTitledBorder("Copy Type")); 78 79 buttonGroup1.add(jRadioButton1), 80 jRadioButton1 .se(Text("Colour"); 81 82 buttonGroup1.add(jRadioButton2); ¢ \ 83 jRadioButton2. setText("Black/White"); : 84 85 javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4), 86 jPanel4.setLayout(Panel4Layout); 87 jPanel4Layout.setHorizontalGroup( 88 jPanel4Layout.createParallelGroup(javax.swing.GroupLayout Alignment.LEADING) 89 .addGroup (Panel4Layout.createSequentialGroup(). 90 .addContainerGap(javax.swing.GroupLayout. DEFAULT, SIZE, Short. MAX_VALUE) 91 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 92 ,addGroup(javax.swing.GroupLayout. Alignment. TRAILING, jPanel4|ayout.createSequentialGroup() 93 .addComponent(jRadioButton1) 94 addGap(36, 36, 36)) 95 .addGroup(javax.swing.GroupLayout Alignment. TRAILING, JPanel4layout.createSequentialGroup() 96 ,addComponent(jRadioButton2) 97 .addContainerGap()))) 98 ) 99 jPanel4Layout.setVerticalGroup( 100 jPanel4Layout,createParallelGroup(javax.swing.GroupLayout Alignment. LEADING) 101 .addGroup(jPanel4Layout.createSequentialGroup() 102 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 103 .addComponent(jRadioButton4) € ‘ 104 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement. UNRELATED) 105 .addComponent(jRadioButton2)) 4106 ) 107 108 jLabel3.setText("Print Type "); 109 110 jLabel4.setText("NAME"); 1411 412 jButton1 setText(‘CAPTURE DATA"), 113 jButton1 addActionListener(new java.awt.event.Action|istener() { 114 public void actionPerformed(java.awt.event ActionEvent evt) { 415 jButton1ActionPetformed(evt); 116 } 117 dv 118 119 jButton2.setText("PROCESS"), 120 _jButton2.addActionListener(new java.awt.event.ActionListener() { 121 public’ void actionPerformed(java.awt.event.ActionEvent evt) { 2.1 of 8 2015.06.08 12:36:55
— Downloaded from hlayiso.com Grl0 Paperl MEMO Quest2 122 jButton2ActionPerformed(evt); 123 } 124 yi 125 126 Javax.swing.GroupLayout jPanel2Layout = new javax.swing.Grouplayout(jPanel2); 127 jPanel2.setLayout(jPanel2Layout); 128 jPanel2Layout.setHorizontalGroup( 129 JPanel2Layout.createParallelGroup(avax.swing.GroupLayout.Alignment.LEADING) 130 -addGroup(jPanel2Layout.createSequentialGroup() 1342, -addContainerGap() 132 .addGroup(jPanel2Layout.createParalleIGroup(javax.swing, GroupLayout.Alignment. LEADING) 133 -addGroup(jPanel2Layout.createSequentialGroup() 134 -addGroup(jPanel2Layout. createParallelGroup (javax.swing. GroupLayout.Alignment.LEADING) 135 .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED. SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) 136 .addComponent(jLabel3)) 137 -addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 138 ,addGroup(jPanel2Layout.createSequentialGroup() 139 .addPreferredGap(avax.swing. LayoutStyle. ComponentPlacement. UNRELATED) 140 .addGroup (jPanei2Layout.createParallelGroup(javax.swing.GroupLayout. Alignment.LEADING) 141 addGroup(jPanel2Layout.createSequentialGroup() 142 ,addGap(0, 0, Short. MAX_VALUE) 143 -addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout Alignment. TRAILING) 144 .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)} 145 .addComponent(jLabel1, javax.swing.GroupLayout. PREFERRED_SIZE, 125, javax.swing,GroupLayout.PREFERRED_SIZE)) 146 . .addGap(26, 26, 26) 147 ” .addGroup(jPanel2Layout.createParallelGroup (javax.swing.GroupLayout.Alignment. LEADING) 148° .addComponent((ComboBox1, javax.swing.GroupLayout. Alignment. TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout. DEFAULT, SIZE, javax.swing.GroupLayout. PREFERRED_SIZE) 149 -addComponent(jSpinner1, javax.swing.GroupLayout Alignment. TRAILING, javax.swing.Grouplayout, PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)) 150 .addGap(30, 30, 30)) 151 .addComponent(jTextField1)) 162 -addContainerGap()) 153 -addGroup(jPanel2Layout.createSequentialGroup() 184 .addGap(33, 33, 33) 155 -addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED, SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_ SIZE) 156 .addContainerGap(javax.swing.GroupLayout. DEFAULT_SIZE, Short. MAX_VALUE)))) 157 .addGroup(jPanel2Layout.createSequentialGroup() 158 -addComponent(jButton1, javax.swing.GroupLayout PREFERRED_SIZE, 198, javax.swing,GroupLayout, PREFERRED_SIZE) 159 .addGap(18, 18, 18) 160 .addComponent(jButton2, javax.swing.Groupl_ayout,PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_ SIZE) 161 .addGap(0, 21, Short.MAX_VALUE)))) 162°); 163 JPanei2Layout.setVerticalGroup( 164 JPanel2Layout.createParalle|Group(javax.swing,GroupLayout. Alignment.LEADING) 165 -addGroup(jPanel2Layout.createSequentialGroup() 166 .addGap(19, 19, 19) 167 .addGroup(jPanel2Layout.createParalle|Group(javax.swing.GroupLayout. Alignment. BASELINE) 168 .addGomponent(jLabel1) 169 .addComponent(jSpinnert, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.Groupl.ayout.PREFERRED_SIZE)) 170 -addGap(33, 33, 33) 174 -addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout. Alignment. BASELINE) 172 .addComponent(jComboBox1, Javax.swing.GroupLayout. PREFERRED_SIZE, 32, 3.1 of 8 2015.06.08 12:36:55
Downloaded from hlayiso.com Gr10 Paper! MEMO Javax.swing.GroupLayout.PREFERRED_SIZE) 173 .addComponent(jLabel2)) 174 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement. RELATED) 175 .adidGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout Alignment, LEADING) 176 .addComponent(jLabel3) 177 .addComponent(jPanel4, javax.swing.GroupLayout. PREFERRED_SIZE, javax.swing.GroupLayout,DEFAULT_SIZE, javax.swing.GroupLayout PREFERRED_SIZE)) 178 .addPreferredGap(javax.swing.LayoutStyle. ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 179 .addGroup({Pane!2Layout.createParallelGroup(javax.swing.GroupLayout. Alignment. BASELINE) 180 .addComponent(jLabel4) 181 .addComponent(TextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing, GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout, PREFERRED_SIZE)) 182 .addGap(24, 24, 24) 183 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 184 .addComponent(jButton1) 185 .addComponent(jButton2)) 186 .addContainerGap()) 187 y 188 189 jPanel3,setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Quotation", javax.swing.border.TitledBorder.CENTER, javax.swing.border. TitledBorder. DEFAUL.T_POSITION)); 490 191 jTextArea1.setColumns(20), 192 jTextArea1 .setRows(5); 193 jScrolfPane1.setViewportView(jTextArea1); 194 195 jButton3.setText("Print Quote"); 196 jButton3 addActionListener(new java.awt.event.ActionListener() { 197 public void actionPerformed(java.awt.event.ActionEvent evt) { 198 JButton3ActionPerformed(evt); 199 } 200) 201 202 javax.swing.GroupLayout jPanel3Layout = new javax.swing.Groupl.ayout(Panel3); 203 jPanel3.setLayout(jPanel3Layout); 204 jPanel3Layout.setHorizontalGroup( 205 jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 206 .addGroup(jPanel3Layout.createSequentialGroup() 207 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 208 .addGroup(jPanel3Layout.createSequentialGroup() 209 -addGap(65, 65, 65) 210 .addComponent(jButton3, javax.swing.GroupLayout. PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)) 2411 .addGroup(jPanel3L.ayout.createSequentialGroup() 212 .addContainerGap(). 213 .addComponent(ScrollPane1, javax.swing.GroupLayout, PREFERRED-SIZE, 251, javax.swing.GroupLayout, PREFERRED_SIZE))) 214 .addContainerGap(javax.swing.GroupLayout, DEFAULT_SIZE, Short.MAX_VALUE)) 215 ) 216 jPanel3Layout.setVerticalGroup( 217 jPanel3Layout.createParallelGroup(javax. swing.GroupLayoutAlignment..EADING) 218 .addGroup(javax.swing.GroupLayout.Alignment. TRAILING, jPanel3Layout.createSequentialGroup() 219 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 220 ,addComponent(jButton3) 221 .addPreferredGap(javax.swing .LayoutStyle.ComponentPlacement. UNRELATED) 222 .addComponent(jScrallPane1, javax.swing.GroupLayout. PREFERRED_SIZE, 251, javax.swing.GroupLayout PREFERRED_SIZE) 223 .addGap(7, 7, 7) 224.) 225 Quest2 4.1 of 8 2015.06.08 12:36:55
Downloaded from hlayiso.com Quest? Grl0 Paper] MEMO 226 javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(/Panel’); 227 jPanel1.setLayout(/Panelt Layout); 228 jPanel1 Layout.sethorizontalGroup( 229 jPaneliLayout.createParallelGroup(javax.swing.GroupLayout Alignment.LEADING) 230 .addGroup(jPanel1 Layout.createSequentialGroup() 231 addGap(29, 29, 29) 232 -addComponent(jPanel2, javax.swing.GroupLayout. PREFERRED_SIZE, javax.swing.GroupLayout. DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 233 saddGap(18, 18, 18) 234 .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout. DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED, SIZE) 235 .addContainerGap(97, Short.MAX_VALUE)) 236° +); 237 jPanel1Layout.setVerticalGroup( 238 jPaneH Layout.createParalielGroup(javax.swing.GroupLayout.Alignment.LEADING) 239 .addGroup(javax.swing.GroupLayout. Alignment. TRAILING, jPaneli Layout.createSequentialGroup() 240 .addGap(42, 42, 42) 241 .addGroup(jPanelt Layout.createParallelGroup(javax.swing.GroupLayout. Alignment. TRAILING) 242 .addComponent(jPanei3, javax.swing.GroupLayout. DEFAULT_SIZE, javax.swing.GroupLayout, DEFAULT_SIZE, Short, MAX_VALUE) 243 .addComponent(jPanel2, javax.swing.GroupLayout. DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short. MAX_VALUE)) 244 .addContainerGap()) 245): 246 247 javax.swing.GroupLayout layout = new Javax.swing.GroupLayout(getContentPane()); 248 getContentPane().setLayout(layout); 249 layout.setHorizontalGroup( 250 layout.createParallelGroup(javax.swing.GroupLayout.Alignment. LEADING) 251 .addGroup(javax.swing.GroupLayout Alignment. TRAILING, layout.createSequentialGroup() 252 ,addContainerGap() 253. .addComponent(jPanel, javax.swing.GroupLayout. DEFAULT, SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short. MAX_VALUE) 254 .addContainerGap()) 255 oH 256 layout.setVerticalGroup( 257 layout.createParallelGroup(javax.swing.GroupLayout.Alignment, LEADING) 258 .addGroup(javax.swing.GroupLayout.Alignment. TRAILING, layout.createSequentialGroup() 259 .addContainerGap() 260 .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Shor MAX_VALUE) 261 addContainerGap()) 262 ‘ 263 264 pack(); 265 =I </editor-fold> 266 267 private vold jButton1 ActionPerformed(java.awt.event.ActionEvent evt) { 268 269 270 271 272 273 274 275 276 277 278 279 280 5.1 of 8 numCopies = (int)(j{Spinner1 .getValue()); JOptionPane.showMessageDialog(null, numCopies+"); String grd = (String)(jComboBox1 .getSelecteditem()); gr = integer.parselnt(grd); name = jTextField1.getText(); if(RadioButton1 .isSelected()) { if (gr == 13) { numCol = Integer.parse!nt(JOptionPane.showInputDialog(Enter number of colour copies!")), numBlack = numCopies - numCol; } else { numBlack = numCopies; 2015.06.08 12:36:55
Downloaded from hlayiso.com Grl0 Paper MEMO 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 314 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 334 332 333 334 335 336 337 338 339 340 344 6.1 of 8 JOptionPane.showMessageDialog(null,"You Cannot choose Golour!”); } else { numBlack = numCopies; } } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { switch (gr) { case 8: case 9: { if(numCopies>15 && numCopies >50){ price = 15*0,5 + 35*0.8 + (numCopies - 50)*1.8; Jelse { if(numCopies >15 && numCopies<=50){ price = 15*0.5 + (numCopies -15) “0.8; } else{ price = numCopies*0.5;} } } break; case 10: case 11: { if(numCopies>25 && numCopies >50){ price = 15*0.8 + 251.3 + (numCopies - 50)*2.5; jelse { if(numCopies >15 && numCopies<=50){ price = 15*0.8 + (numCopies -25) *1.3; } else{ price = numCopies*0.8;} } } break; case 12: { if(numCopies>15 && numCoples >35){ price = (35-15)*1.1 + (numCopies - 35)*1.6; jelse { if(numCoples >15 && numCopies<=35){ price = (numCopies -15) *1.1; } } break; case 13:{ price = numCol * 4; } break; i deault: JOptionPane.showMessageDialog(null,"INVALID!"); } private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { jTextArea1 append("NAME \t"+name+'\n"); if(gr == 13){ jTextAreat .append("TEACHER\n'); } else { JTextAreat append("GRADE \t"+gr+"\n"); } Quest2 2015.06.08 12:36:55
Downloaded from hlayiso.com Grl0 Paper! MEMO Quest2 342 jTextArea1.append¢("NUM of Black Copies \t:"+numBlack+'\n"), 343 jtextAreat.append("NUM of Colour Copies \t"+numCol+"\n"); 344 jTextArea1 .append("PRICE \t‘R"+d.format(price)+"\n"); 345} 346 347° 348 = * @param args the command line arguments 349° 350 public static void main(String args[]) { 351 /* Set the Nimbus look and feel */ 352 //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> 353 /* lf Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. 354 * For details see http://download.oracle.convjavase/tutorial/uiswing/lookandfeel/plaf.html 355 “ 356° try{ 357 for (javax.swing.UIManager.LookAndFeellnfo info : javax.swing.UIManager.getinstalledLookAndFeels()) { 368 if (‘Nimbus".equals(info.getName())) { 359 javax.swing.UIManager.setLookAndFeel(info.getClassName()); 360 break; 361 } cy 362 } wo. 363} catch (ClassNotFoundException ex) { 364 Java.util.logging.Logger.getLogger(Q2Frame.class.getName()).log(ava.util.logging.Level.SEVERE, null, ex); 365 } catch (InstantiationException ex) { a 366 java.util. logging.Logger.getLogger(Q2Frame.class getName()).log(java.util logging.Level.SEVERE, null, ex); 367 } catch (IllegalAccessException ex) { 368 java.util.logging.Logger.getLogger(Q2Frame.class.getName()).log(java.util.logging.Level. SEVERE, null, ex); 369 } catch avax.swing.UnsupportedLookAndFeelException ex) { 370 java.util. logging. Logger.getLogger(Q2Frame.class.getName()).log(Gava.util.logging.Level.SEVERE, null, eX); a7} 372 Jsleditor-fold> 373 374 /* Create and display the form */ 375 java.awt.EventQueue.invokeLater(new Runnable() { 376 public void run() { 377 new Q2Frame().setVisible(true); 378 } 379 380 } 381 // Variables declaration - do not modify ” 382 private javax.swing.ButtonGroup buttonGroup1; f } 383 private javax.swing.JButton jButton1; 7 384 private Javax.swing.JButton jButton2; 385 private Javax.swing.JButton jButton3; 386 _ private javax.swing.JComboBox jComboBox1; 387 private javax.swing.JLabel jLabel1; 388 private javax.swing.JLabel jLabel2; 389 private javax.swing.JLabel jLabel3; 390 private javax.swing.JLabel jLabel4; 391 _ private javax.swing.JLabel jLabelé; 392 private javax.swing.JPanel JPanel; 393 private javax.swing.JPanel JPanel2; 394 private javax.swing.JPanel jPanel3; 395. private javax.swing.JPanel jPanel4; 396 private javax.swing.JRadioButton jRadioButton1; 397 _ private javax.swing.JRadioButton jRadioButton2; 398 private javax.swing.JScrollPane jScrollPane1; 399 _ private javax.swing.JSpinner jSpinnert; 400 _ private javax.swing.JTextArea jTextAreat; 401 private javax.swing.JTextField jTextField1; 402 // End of varlables declaration 7A of 8 2015.06.08 12:36:55
Downloaded from hlayiso.com neat Grl10 Paper! MEMO Quest2 403 } 8.1 of 8 2015.06.08 12:36:55

Study this subject

Revise the topics in this paper, then practise them question by question.

More papers and memos for this grade and subject.

More from Grade 10 Information Technology

View all