Professional Documents
Culture Documents
To be filled by Student
Explain your semester project in the light of Software Development Life Cycle (SDLC). [Marks: 8]
iii. What kind of tools and techniques you adopted in Implementation or coding phase.
iv. What problems you faced in Testing phase and What steps you have performed in
Answer:
Part 1:
Online Food Order App:
Requirement gathering and analysis phase:
As it is the most important phase in software development life cycle, I try my level best do collect
and gather information and analysis the situation.
I did a fine analysis on every aspects and try to avoid any future conflicts.
Part 2:
Design Phase:
This is an important stage of app design as it is compulsory to have a good design of your app.
With the help of 1st phase I design my app quite well.
Although I had face some difficulty in making design as many other apps were using the same
design. So to make my app different from others I put unique styling.
Part 3:
Implementation and Coding Phase:
In this step, the actual implementation and coding for app takes place. For that we use different
tools and techniques to make our implementation effective.
Part d:
Testing Phase:
I firstly test my app on smaller group of people so that I may get an idea about how to move on.
Then after successful running of my app I further increase my testing on larger group.
Development Phase:
I have developed my app because of successful test on some group of people. I had put this app on
Google play store in order to get benefit of my hard work and to provide service to others.
Question # 2 Answer the followings using Java Code
a. How you will read an MS Excel file in Java. Read an MS Excel File in Java
f. Create a text file in Java, then Write complete Java code to Write the following text to
Text file
Finally, write Java code to read the text from the text file and display it on the jTextFields.
Question 2:
Part a:
Apache POI (Poor Obfuscation Implementation) is a Java API for reading and writing
Microsoft Documents in both formats .xls and .xlsx. It contains classes and interfaces.
The Apache POI library provides two implementations for reading excel files:
Java code:
1. import java.io.File;
2. import java.io.FileInputStream;
3. import java.io.IOException;
4. import org.apache.poi.hssf.usermodel.HSSFSheet;
5. import org.apache.poi.hssf.usermodel.HSSFWorkbook;
6. import org.apache.poi.ss.usermodel.Cell;
7. import org.apache.poi.ss.usermodel.FormulaEvaluator;
8. import org.apache.poi.ss.usermodel.Row;
9. public class ReadExcelFileDemo
10. {
11. public static void main(String args[]) throws IOException
12. {
13. //obtaining input bytes from a file
14. FileInputStream fis=new FileInputStream(new File("C:\\demo\\student.xls"));
15. //creating workbook instance that refers to .xls file
16. HSSFWorkbook wb=new HSSFWorkbook(fis);
17. //creating a Sheet object to retrieve the object
18. HSSFSheet sheet=wb.getSheetAt(0);
19. //evaluating cell type
20. FormulaEvaluator formulaEvaluator=wb.getCreationHelper().createFormulaEvalua
tor();
21. for(Row row: sheet) //iteration over row using for each loop
22. {
23. for(Cell cell: row) //iteration over cell using for each loop
24. {
25. switch(formulaEvaluator.evaluateInCell(cell).getCellType())
26. {
27. case Cell.CELL_TYPE_NUMERIC: //field that represents numeric cell type
28. //getting the value of the cell as a number
29. System.out.print(cell.getNumericCellValue()+ "\t\t");
30. break;
31. case Cell.CELL_TYPE_STRING: //field that represents string cell type
32. //getting the value of the cell as a string
33. System.out.print(cell.getStringCellValue()+ "\t\t");
34. break;
35. }
36. }
37. System.out.println();
38. }
39. }
40. }
Part b:
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.*;
public drawImage() {
try {
b[0] = ImageIO.read(new File("img/gameOn.png"));
b[1] = ImageIO.read(new File("img/gameOff.png"));
} catch (IOException e) {
e.printStackTrace();
}
g.drawImage(b[0], 0, 0, null);
b[0] = image;
repaint();
}
@Override
public void actionPerformed(ActionEvent e) {
new drawImage().setNextImage(next);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.setVisible(true);
jf.setLayout(new GridLayout(2, 0));
jf.add(new drawImage());
jf.add(btn);
jf.setSize(200, 250);
btn.addActionListener(new clickedListener());
Part c:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
public MyJFrame()
{
this.setSize(400,400);
this.setTitle("Wave audio player");
this.setComponents();
this.setListeners();
}
}
Part d:
try{
//create a player to play the media specified in the URL
Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, true);
//get the components for the video and the playback controls
Component video = mediaPlayer.getVisualComponent();
Component controls = mediaPlayer.getControlPanelComponent();
if ( video != null )
jPanel1.add( video, BorderLayout.CENTER ); //add video component
if ( controls != null )
jPanel1.add( controls, BorderLayout.SOUTH ); //add controls
Part e:
For instance, to paint a blue circle centered at a given location, you need to
write the following code:
4
5 public void paintComponent(Graphics g) {
6 super.paintComponent(g); // paint whatever normally gets painted.
7 g.setColor (color); // set the color to paint with
8 g.fillOval (location.x-radius, location.y-
radius, 2*radius, 2*radius); // paint a circle onto the graphics object
centered on location and with defined radius.
}
Part f:
import java.io.*;
import javax.swing.*;
import java.util.*;
public Microsystems() {
initComponents();
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jTextField1.setToolTipText("");
jTextField1.setDoubleBuffered(true);
jTextField1.setDragEnabled(true);
jTextField2.setHorizontalAlignment(javax.swing.JTextField.LEFT);
jButton1.setText("Write to file");
jButton1.addActionListener(new java.awt.event.ActionListener() {
jButton1ActionPerformed(evt);
});
jButton2.addActionListener(new java.awt.event.ActionListener() {
jButton2ActionPerformed(evt);
});
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap(46, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(253, 253, 253)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton1)
.addComponent(jButton2)
.addContainerGap(16, Short.MAX_VALUE))
);
jTextField1.getAccessibleContext().setAccessibleParent(null);
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try {
myWriter.write(jTextField1.getText());
myWriter.close();
JOptionPane.showMessageDialog(null,"Successfully saved");
} catch (IOException e) {
e.printStackTrace();
try {
while (myReader.hasNextLine()) {
total +=data;
jTextField2.setText(total );
myReader.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(Microsystems.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
java.util.logging.Logger.getLogger(Microsystems.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
java.util.logging.Logger.getLogger(Microsystems.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
java.util.logging.Logger.getLogger(Microsystems.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new Microsystems().setVisible(true);
});