Guest User

Untitled

a guest
Sep 25th, 2018
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. Here is what you do: create a class named MyRecord (MyRecord.java) with the
  2. variables firstname, lastname, email, idnumber, color and balance. Use the
  3. appropriate data type for each field.
  4.  
  5. public class MyRecord {
  6.  
  7. String firstname, lastname, email, color;
  8. double idnumber, balance;
  9. }
  10.  
  11. MyRecord recarray[] = new MyRecord[ARRAYSIZE];
  12. //ARRAYSIZE is 10
  13.  
  14. String filename = "data.txt";
  15. File fileobject = new File(filename);
  16. Scanner input = new Scanner(fileobject);
  17.  
  18. for(int i = 0; i <= 5; i++) {
  19. recarray[i] = input.next();
  20. }
  21.  
  22. Mary, Jane, maryj@gmail.com, 7654321, blue, 27.54
  23. John, Doe, jd@yahoo.com, 123456, green, 19.24
  24. Curly, Howard, nyuknyuk@msn.com, 888765, purple, 0.0
  25. Bart, Simpson, donthaveacow@hotmail.com, 457673, magenta, 432.23
  26. Clark, Kent, superdude@dailyplanet.com, 976834, red, 11.10
Add Comment
Please, Sign In to add comment