Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Andres Roa
- * Period One
- * Steelman
- * Methods Practice
- */
- import java.awt.Color;
- import java.awt.Font;
- import javax.swing.JOptionPane;
- import javax.swing.UIManager;
- import javax.swing.plaf.FontUIResource;
- public class MethodPractice
- {
- public static double biggest()
- {
- double double1 = Double.parseDouble(JOptionPane.showInputDialog("Enter a double:"));
- double double2 = Double.parseDouble(JOptionPane.showInputDialog("Enter another double:"));
- double biggest = Math.max(double1,double2);
- return biggest;
- }
- public static double average (int num1, int num2)
- {
- double average = (num1 +num2)/2.0;
- return average;
- }
- public static void pigLatin(String english)
- {
- char first = english.charAt(0);
- String second = english.substring(1);
- String pig = second + first + "ay";
- System.out.println(pig);
- }
- public static void changeJOP()
- {
- // Here are the commands to change the color & fonts in
- // the showMessageDialog() window:
- // The font of the message text
- UIManager.put("Label.font", new FontUIResource
- (new Font("Baskerville Old Face", Font.BOLD, 45)));
- // The color of the message text
- UIManager.put("OptionPane.messageForeground",new Color(72,61,139));
- // The color of the panel
- UIManager.put("Panel.background",new Color(205,197,191));
- // The color around the outside of the panel
- UIManager.put("OptionPane.background",new Color(124-252-0));
- // Buttons at bottom
- UIManager.put("Button.background",new Color(132,112,255));
- UIManager.put("Button.foreground", new Color(72,61,139));
- UIManager.put("Button.font", new FontUIResource
- (new Font("Tempus Sans ITC", Font.BOLD, 14)));
- }
- public static void main(String[] args)
- {
- changeJOP();
- System.out.printlnSystem.out.println(double variable syso= biggest());
- System.out.println(double variable = average(int1,int2));
- System.out.println(pigLatin("Hello"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement