Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package practise;
- import javax.swing.JOptionPane;
- public class Practise {
- public static void main(String[] args) {
- String input = JOptionPane.showInputDialog("Enter your birth year: ");
- String inputs = JOptionPane.showInputDialog("Enter your name: ");
- String gender = JOptionPane.showInputDialog("Enter your gender: ");
- int year = Integer.parseInt(input);
- int age = 2022-year;
- String name = inputs;
- String genders = gender;
- String Male = "Mr.";
- String Female = "Ms.";
- if (gender == Male){
- JOptionPane.showMessageDialog(null, "Mr." + name+ age+" years old!");
- }else {
- JOptionPane.showMessageDialog(null, "Ms." + name+ age+" years old!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement