All pastes #477578 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-08 18:48 UTC
rendered paste body
// The "Excercise8N" class.
import java.awt.*;
import hsa.Console;

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

    public static void main (String[] args)
    {
        c = new Console ();
        int fieldwidth;
        double morning = 0, evening = 0, num = 0;
        String share, day, fieldwidth1;
        day = ("MONDAY");
        c.println ("Enter the name of the share");
        share = c.readString ();
        for (int i = 1 ; i <= 5 ; i++)
        {
            for (int x = 1 ; x <= 1 ; x++)
            {

                c.println ("Enter the morning price for any one share");
                morning = c.readDouble ();

                c.println ("Enter the evening price for the same share");
                evening = c.readDouble ();
                if (i == 1)
                {
                    day = ("MONDAY");
                }
                else if (i == 2)
                {
                    day = ("TUESDAY");
                }
                else if (i == 3)
                {
                    day = ("WEDNESDAY");
                }
                else if (i == 4)
                {
                    day = ("THURSDAY");
                }
                else if (i == 5)
                {
                    day = ("FRIDAY");
                }
                c.println (day.length ());
                c.print ("DAY", 10);
                c.print ("MORNING PRICE", 20);
                c.println ("EVENING PRICE", 20);
                c.print (day, 5);
                c.print (morning, 18 - day.length ());
                c.println (evening, 20);

                if ((evening / morning) > 1)
                {
                    c.print ("The percentage increase is ");
                    c.print (((evening / morning) * 100) - 100, 2, 2);
                    c.println ("%");
                }
                else if ((evening / morning) == 1)
                {
                    c.println ("There was no increase or decrease");
                }
                else
                {
                    c.print ("The percentage decrease is ");
                    c.print ((((evening / morning) * 100) - 100) * -1, 2, 2);
                    c.println ("%");
                }
            }
        }


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