Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.94 KB | None | 0 0
  1. /*
  2.  * Andres Roa
  3.  * Period One
  4.  * Steelman
  5.  * Methods Practice
  6.  */
  7. import java.awt.Color;
  8. import java.awt.Font;
  9.  
  10. import javax.swing.JOptionPane;
  11. import javax.swing.UIManager;
  12. import javax.swing.plaf.FontUIResource;
  13. public class MethodPractice
  14. {
  15.  public static double biggest()
  16.   {
  17.    
  18.    double double1 = Double.parseDouble(JOptionPane.showInputDialog("Enter a double:"));
  19.    double double2 = Double.parseDouble(JOptionPane.showInputDialog("Enter another double:"));
  20.    double biggest = Math.max(double1,double2);
  21.    return biggest;
  22.    
  23.    
  24.   }
  25.   public static double average (int num1, int num2)
  26.   {
  27.  
  28.    double average = (num1 +num2)/2.0;
  29.    return average;
  30.  
  31.   }
  32.   public static void pigLatin(String english)
  33.   {
  34.   char first = english.charAt(0);
  35.   String second = english.substring(1);
  36.   String pig = second + first + "ay";
  37.   System.out.println(pig);
  38.   }
  39.  
  40.  
  41.  public static void changeJOP()
  42.  {
  43.     // Here are the commands to change the color & fonts in
  44.     // the showMessageDialog() window:
  45.    
  46.     // The font of the message text
  47.     UIManager.put("Label.font", new FontUIResource
  48.       (new Font("Baskerville Old Face", Font.BOLD, 45)));
  49.     // The color of the message text
  50.     UIManager.put("OptionPane.messageForeground",new Color(72,61,139));
  51.    
  52.     // The color of the panel
  53.     UIManager.put("Panel.background",new Color(205,197,191));
  54.     // The color around the outside of the panel
  55.     UIManager.put("OptionPane.background",new Color(124-252-0));
  56.    
  57.    
  58.     // Buttons at bottom
  59.     UIManager.put("Button.background",new Color(132,112,255));
  60.     UIManager.put("Button.foreground", new Color(72,61,139));
  61.     UIManager.put("Button.font", new FontUIResource
  62.       (new Font("Tempus Sans ITC", Font.BOLD, 14)));
  63.    
  64.  
  65.   }
  66.  
  67.  public static void main(String[] args)
  68.  {
  69.    changeJOP();
  70.    System.out.printlnSystem.out.println(double variable syso= biggest());
  71.    System.out.println(double variable = average(int1,int2));
  72.    System.out.println(pigLatin("Hello"));
  73.  }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement