Managing Data - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Managing Data

Description:

Artist[0] = 'System of a Down'; Song[0] = 'Hypnotize'; Artist[1] = 'Every Time I Die' ... Put all the database info into a file, rather than in your code. ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 7
Provided by: msresearch
Category:
Tags: data | down | managing | of | system

less

Transcript and Presenter's Notes

Title: Managing Data


1
Managing Data
  • Databases
  • Arrays, Lists, and File I/O

2
An Array-based database
  • public static String Artist new String5
  • public static String Song new String5
  • public static int length 0
  • public static void main(String args)
  • length Artist.length
  • Artist0 "System of a Down"
  • Song0 "Hypnotize"
  • Artist1 "Every Time I Die"
  • Song1 "Kill the Music"
  • // etc

3
Whats wrong with this
  • Two arrays must be synchronized
  • Filling the arrays with Artists and Songs is done
    IN THE CODE. Bad.
  • One more thing.

4
Sorting
  • public static void sortByArtist()
  • for (int y 0 y
  • for (int z 0 z
  • if ( Artistz.compareTo(Artisty) 0 )
  • swap( y,z)
  • // end if
  • // end for z
  • // end for y
  • // end sort by artist

5
Swap permanently moves items
  • public static void swap( int a, int b)
    String temp temp Artista Artista
    Artistb Artistb temp temp Songa
    Songa Songb Songb temp

6
Step 1 get information from files
  • Put all the database info into a file, rather
    than in your code.
Write a Comment
User Comments (0)
About PowerShow.com