Advertisement
Guest User

Untitled

a guest
Dec 19th, 2018
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. void readFile(){
  2.  
  3. try {
  4. Scanner output=new Scanner(cakeDetalies);
  5. while(output.hasNext()){
  6. c[i]=new cake();
  7. String s=output.next();
  8. c[i].setName(s);
  9. s=output.next();
  10. c[i].setQuantity(Integer.parseInt(s));
  11. s=output.next();
  12. c[i].setPrice(Integer.parseInt(s));
  13. list.addElement(c[i].name);
  14. i++;
  15. }
  16. } catch (FileNotFoundException ex) {
  17. Logger.getLogger(client.class.getName()).log(Level.SEVERE, null, ex);
  18. }
  19. }
  20. void writeFile(int size){
  21. try {
  22. iutput = new PrintWriter("cakeDetalies.txt");
  23. for(int i=0;i<size;i++)
  24. iutput.println(c[i].getProduct());
  25. iutput.close();
  26. } catch (FileNotFoundException ex) {
  27.  
  28. }
  29. }
  30. void initializeList(int size){
  31. try {
  32. iutput = new PrintWriter(cakeDetalies);
  33.  
  34.  
  35. } catch (FileNotFoundException ex) {
  36. Logger.getLogger(client.class.getName()).log(Level.SEVERE, null, ex);
  37. }
  38. for(int i=0;i<size;i++){
  39. list.addElement(c[i].getName());
  40. iutput.println(c[i].getProduct());
  41. }
  42. iutput.close();
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement