import ccj.*; public class PlotData2 extends GraphicsApplet { public void run() { int n = readInt("How many data points?"); Product[] data = new Product[n]; int i; for (i = 0; i < n; i++) { Product c = new Product(); c.read(); data[i] = c; } setCoord(0, MAX_SCORE, MAX_PRICE, 0); for (i = 0; i < n; i++) data[i].draw(); } private static double MAX_PRICE = 10000; private static double MAX_SCORE = 100; } class Product { public Product() { name = ""; price = 0; score = 0; } public void read() { name = GraphicsApplet.readString("Product name:"); price = GraphicsApplet.readDouble("Price:"); score = GraphicsApplet.readInt("Score:"); } public void draw() { Message label = new Message(new Point(price, score), name); label.getStart().draw(); label.draw(); } private String name; private double price; private int score; }