/** * ITI 1220 Fall 2005, Assignment 8, Question 1 * * Program to use the 'Product' class. * * @author Alan Williams */ public class A8Q1 { /** * Main method to test the Product class. * * @param args Command line arguments. */ public static void main( String[] args ) { // DECLARE VARIABLES / DATA DICTIONARY Product book; Product ticket; Product game; // PRINT IDENTIFICATION INFORMATION System.out.println( "A8Q1: Test of the class Product" ); System.out.println( ); // BODY OF ALGORITHM // Create some product objects. ticket = new Product( "Ottawa-Cuba", 1199.99, 250000 ); book = new Product( "Harry Potter VI", 29.99, 7500 ); game = new Product( "Quake 4", 59.99, 10000 ); // Use accessors to get values from Product objects. System.out.println( ticket.getName( ) + ": " + "$" + ticket.getCost( ) + ", " + ticket.getPointsRequired( ) ); System.out.println( book.getName( ) + ": " + "$" + book.getCost( ) + ", " + book.getPointsRequired( ) ); System.out.println( game.getName( ) + ": " + "$" + game.getCost( ) + ", " + game.getPointsRequired( ) ); } }