Advertisement
AlphaPenguino

Object_Traits

Mar 9th, 2023
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.79 KB | None | 0 0
  1. public class Traits {
  2.    
  3.     String zodiac;
  4.     int age;
  5.     String mbti;
  6.     String name;
  7.    
  8.     Traits(String name, String zodiac, int age, String mbti) {
  9.         this.name = name;
  10.         this.zodiac = zodiac;
  11.         this.age = age;
  12.         this.mbti = mbti;
  13.     }
  14.    
  15.     void natutulog(){
  16.         System.out.println("Si " + this.name + " ay natotolog!");
  17.     }
  18.    
  19.     void ilangtaon() {
  20.         System.out.println("Si " + this.name + " ay " + this.age + " years old na!");
  21.     }
  22.    
  23.     void personality() {
  24.        
  25.         System.out.println("Ang advice ko para sa " + this.zodiac + " ay " + description());
  26.        
  27.     }
  28.     void showAll() {
  29.         System.out.println("Si " + this.name + " na " + this.age + " years old,\nwith personality type of " + this.mbti + ", your " + this.zodiac + " zodiac advice/description is " + description());
  30.     }
  31.    
  32.     public String description() {
  33.        
  34.         String message = new String();
  35.        
  36.         switch (this.zodiac) {
  37.            
  38.             case "aries" -> message = ("bobo ka");
  39.             case "taurus" -> message = ("matalino at pogi");
  40.             case "gemini" -> message = ("wala kang pera");
  41.             case "cancer" -> message = ("wag ka magpuyat");
  42.             case "leo" -> message = ("tara ML");
  43.             case "virgo" -> message = ("wag nang umasa");
  44.             case "libra" -> message = ("tama na ang chismis");
  45.             case "scorpio" -> message = ("team payaman");
  46.             case "sagittarius" -> message = ("wag na mag cutting");
  47.             case "capricorn" -> message = ("pumasok ka naman huy");
  48.             case "aquarius" -> message = ("wag maging racis");
  49.             case "pisces" -> message = ("tama na kaka FB tol");
  50.         }
  51.         return message;
  52.        
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement