Docstoc

hw1 HW1 public class aardvark public static void main String args

Document Sample
hw1 HW1 public class aardvark public static void main String args Powered By Docstoc
					                                                HW1
public class aardvark
{
   public static void main (String[] args)
   {

          System.out.println("     ,__     _,                      ___                                     ");
            System.out.println("                '.`\\ /`|                _.-\"```            `'.                  "
);
           System.out.println("                   ; | /    .'                                  `}             ");
           System.out.println("                   _\\|\\/_.-'                                        }
");
           System.out.println("             _.-\"a                                   {               }
");
           System.out.println("          .-`    __       /._                     {                  }\\
");
           System.out.println("          '--\"`       `\"\"`        `\\      ;           {                 } \\
");
           System.out.println("                                |         } __ _\\                   }\\     \\
");
           System.out.println("                                |     /;`     / :.            }`      \\     \\
");
           System.out.println("                                | | | .-' /               / /             '. '._
");
       System.out.println("                      jgs      .'__/-' ````.-'.'                                '-._'-
._ ");
    System.out.println("                        ```                ````                             `\"\"\"`
");


      }
}




import javax.swing.*;
public class change
{
   public static void main (String[] args)
   {
int Pennies =
   Integer.parseInt(JOptionPane.showInputDialog(null,
      "How many pennies do you have?","Pennies",3));

int Nickles =
   Integer.parseInt(JOptionPane.showInputDialog(null,
      "How many nickles do you have?","Nickles",3));

int Dimes =
   Integer.parseInt(JOptionPane.showInputDialog(null,
      "How many dimes do you have?","Dimes",3));

    int Quarters =
      Integer.parseInt(JOptionPane.showInputDialog(null,
         "How many quarters do you have?","Quaters",3));
    double Value = Pennies * .01 + Nickles * .05 + Dimes * .10 + Quarters * .25;
    System.out.println("Your Total is $"+ Value);


      }
}



public class string
{
   public static void main (String[] args)
   {
     String Sentence ="The quick brown fox jumped over the lazy dog.";
     System.out.println("Length of Sentence = " + Sentence.length());
     System.out.println("Sentence contains the word \"big\" = " +
Sentence.contains("big"));
     System.out.println("Sentence contains the word \"jump\" = " +
Sentence.contains("jump"));
     System.out.println("Sentence ends with a period: = " +
Sentence.endsWith("."));
     System.out.println("First 10 characters of the Sentence: = " +
Sentence.substring(0,10));
     System.out.println("Sentence after replace all spaces with hyphens: = "
+ Sentence.replace(" ","-"));

      }
}

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:12
posted:2/15/2012
language:
pages:2