Computer Science Canada

This isnt really help, just funny ;)

Author:  copthesaint [ Tue Dec 15, 2009 2:17 pm ]
Post subject:  This isnt really help, just funny ;)

This is a very simple class, but the results from typing 11, 22 , 44, or 111 for example are quite amuseing :p.
Running it a couple of time you will soon ask you self, Wtf? :p, I know why it does do it, I just find it amusing lol.
damm precision crap!

Java:
import java.util.Scanner;
    public class Ch04Ex02 {
       public static void main (String [] args) {
         Scanner input = new Scanner (System.in);
         double cost = 0.75 + 1.00;
         System.out.println ("Enter the diameter of the pizza in inches: ");
         double diameter = input.nextDouble();
         cost = cost + (0.05* (diameter * diameter));
         System.out.println ("The cost of making the pizza is: $"+ cost);
         input.close();     
      }
   }


: