All pastes #545183 Raw Edit

Someone

public text v1 · immutable
·published 2007-06-06 18:42 UTC
rendered paste body
// The "Stockgold" class.
import java.awt.*;
import hsa.Console;

public class Stockgold
{
    static Console c;           // The output console

    public static void main (String[] args)
    {
        c = new Console ();

        double morning[] = new double [5];
        String day[] = new String [5];
        double evening[] = new double [5];
        String a = ("MORNING PRICE");
        double percent[] = new double [5];
        String b = ("% Increase/Decrease");

        for (int x = 0 ; x < 5 ; x++)
        {
            c.println ("Enter the day of the month");
            day [x] = c.readString ();
            c.println ("Enter the morning price for that day");
            morning [x] = c.readDouble ();
            c.println ("Enter the evening price for that day");
            evening [x] = c.readDouble ();
            percent [x] = evening [x] / morning [x] * 100 - 100;
        }
        c.print ("DAY", 20);
        c.print ("MORNING PRICE", 20);

        c.print ("EVENING PRICE", 20);
        c.println ("% Increase/Decrease");
        for (int i = 0 ; i < 5 ; i++)
        {
            c.print (day [i]);
            c.print (morning [i], (20 + (a.length () / 2)) - day [i].length (), 2);
            c.print (evening [i], 20, 2);
            c.println (percent [i], 20 + b.length () / 2, 2);
        }

        // Place your program here.  'c' is the output console
    } // main method
} // Stockgold class