Package com.deitel.jhtp6.jsp.beans

Examples of com.deitel.jhtp6.jsp.beans.GuestBean


  
   // update record in file
   public void updateRecord( int accountNumber, double transaction )
      throws IllegalArgumentException, IOException
   {
      RandomAccessAccountRecord record = getRecord( accountNumber );

      if ( record.getAccount() == 0 )
         throw new IllegalArgumentException( "Account does not exist" );

      // seek appropriate record in file
      file.seek( ( accountNumber - 1 ) * RandomAccessAccountRecord.SIZE );  

      record = new RandomAccessAccountRecord(
         record.getAccount(), record.getFirstName(),
         record.getLastName(), record.getBalance() + transaction );
        
      record.write( file ); // write updated record to file     
   } // end method updateRecord
View Full Code Here


   // add record to file
   public void newRecord( int accountNumber, String firstName,
      String lastName, double balance )
      throws IllegalArgumentException, IOException
   {
      RandomAccessAccountRecord record = getRecord( accountNumber );
     
      if ( record.getAccount() != 0 )
         throw new IllegalArgumentException( "Account already exists" );

      // seek appropriate record in file
      file.seek( ( accountNumber - 1 ) * RandomAccessAccountRecord.SIZE );  

      record = new RandomAccessAccountRecord( accountNumber,
         firstName, lastName, balance );
        
      record.write( file ); // write record to file     
   } // end method newRecord
View Full Code Here

  
   // delete record from file
   public void deleteRecord( int accountNumber )
      throws IllegalArgumentException, IOException
   {
      RandomAccessAccountRecord record = getRecord( accountNumber );
     
      if ( record.getAccount() == 0 )
         throw new IllegalArgumentException( "Account does not exist" );
     
      // seek appropriate record in file
      file.seek( ( accountNumber - 1 ) * RandomAccessAccountRecord.SIZE );

      // create a blank record to write to the file
      record = new RandomAccessAccountRecord();
      record.write( file );     
   } // end method deleteRecord
View Full Code Here

   } // end method deleteRecord

   // read and display records
   public void readRecords()
   {
      RandomAccessAccountRecord record = new RandomAccessAccountRecord();

      System.out.printf( "%-10s%-15s%-15s%10s\n", "Account",
         "First Name", "Last Name", "Balance" );
  
      try // read a record and display
      {
         file.seek( 0 );

         while ( true )
         {
            do
            {
               record.read( file );
            } while ( record.getAccount() == 0 );

            // display record contents
            System.out.printf( "%-10d%-15s%-15s%10.2f\n",
               record.getAccount(), record.getFirstName(),
               record.getLastName(), record.getBalance() );
         } // end while
      } // end try
      catch ( EOFException eofException ) // close file
      {
         return; // end of file was reached
View Full Code Here

public class ListTest
{
   public static void main( String args[] )
   {
      List list = new List(); // create the List container

      // insert integers in list
      list.insertAtFront( -1 );
      list.print();
      list.insertAtFront( 0 );
      list.print();
      list.insertAtBack( 1 );
      list.print();
      list.insertAtBack( 5 );
      list.print();

      // remove objects from list; print after each removal
      try
      {
         Object removedObject = list.removeFromFront();
         System.out.printf( "%s removed\n", removedObject );
         list.print();

         removedObject = list.removeFromFront();
         System.out.printf( "%s removed\n", removedObject );
         list.print();

         removedObject = list.removeFromBack();
         System.out.printf( "%s removed\n", removedObject );
         list.print();

         removedObject = list.removeFromBack();
         System.out.printf( "%s removed\n", removedObject );
         list.print();
      } // end try
      catch ( EmptyListException emptyListException )
      {
         emptyListException.printStackTrace();
      } // end catch
View Full Code Here

public class QueueTest
{
   public static void main( String args[] )
   {
      Queue queue = new Queue()

      // use enqueue method
      queue.enqueue( -1 );
      queue.print();
      queue.enqueue( 0 );
      queue.print();
      queue.enqueue( 1 );
      queue.print();
      queue.enqueue( 5 );
      queue.print();

      // remove objects from queue
      try
      {
         Object removedObject = null;

         while ( true )
         {
            removedObject = queue.dequeue(); // use dequeue method
            System.out.printf( "%s dequeued\n", removedObject );
            queue.print();
         } // end while
      } // end try
      catch ( EmptyListException emptyListException )
      {
         emptyListException.printStackTrace();
View Full Code Here

public class StackCompositionTest
{
   public static void main( String args[] )
   {
      StackComposition stack = new StackComposition()

      // use push method
      stack.push( -1 );
      stack.print();
      stack.push( 0 );
      stack.print();
      stack.push( 1 );
      stack.print();
      stack.push( 5 );
      stack.print();

      // remove items from stack
      try
      {
         Object removedObject = null;

         while ( true )
         {
            removedObject = stack.pop(); // use pop method
            System.out.printf( "%s popped\n", removedObject );
            stack.print();
         } // end while
      } // end try
      catch ( EmptyListException emptyListException )
      {
         emptyListException.printStackTrace();
View Full Code Here

public class StackInheritanceTest
{
   public static void main( String args[] )
   {
      StackInheritance stack = new StackInheritance()

      // use push method
      stack.push( -1 );
      stack.print();
      stack.push( 0 );
      stack.print();
      stack.push( 1 );
      stack.print();
      stack.push( 5 );
      stack.print();

      // remove items from stack
      try
      {
         Object removedObject = null;

         while ( true )
         {
            removedObject = stack.pop(); // use pop method
            System.out.printf( "%s popped\n", removedObject );
            stack.print();
         } // end while
      } // end try
      catch ( EmptyListException emptyListException )
      {
         emptyListException.printStackTrace();
View Full Code Here

public class TreeTest
{
   public static void main( String args[] )
   {
      Tree tree = new Tree();
      int value;
      Random randomNumber = new Random();

      System.out.println( "Inserting the following values: " );

      // insert 10 random integers from 0-99 in tree
      for ( int i = 1; i <= 10; i++ )
      {
         value = randomNumber.nextInt( 100 );
         System.out.print( value + " " );
         tree.insertNode( value );
      } // end for

      System.out.println ( "\n\nPreorder traversal" );
      tree.preorderTraversal(); // perform preorder traversal of tree

      System.out.println ( "\n\nInorder traversal" );
      tree.inorderTraversal(); // perform inorder traversal of tree

      System.out.println ( "\n\nPostorder traversal" );
      tree.postorderTraversal(); // perform postorder traversal of tree
      System.out.println();
   } // end main
View Full Code Here

   private SelfContainedPanel myPanel; // panel to draw an oval

   // set up GUI and mouse motion event handlers for application window
   public CustomFrame()
   {
      myPanel = new SelfContainedPanel(); // create self contained panel
      myPanel.setBackground( Color.YELLOW ); // set background to yellow

      setLayout( new FlowLayout() ); // set frame layout
      add( myPanel ); // add self contained panel to frame
View Full Code Here

TOP

Related Classes of com.deitel.jhtp6.jsp.beans.GuestBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.