public class MessageTwo { private String text; private int priority; private static int total; public static int MAX_PRIORITY = 100; public static int getTotal() { return total; } public MessageTwo() { text = "Hello"; priority = 10; total++; } public MessageTwo(String theText, int thePriority) { // I could have used the setMessage method text = theText; priority = thePriority; total++; } public boolean same(MessageTwo msg) { if (text.equals(msg.text) && priority == msg.priority) return true; else return false; } public boolean sameVersion2(MessageTwo msg) { if (this.text.equals(msg.text) && this.priority == msg.priority) return true; else return false; } public void display() { System.out.print("[Contents: = " + text + ", "); System.out.println("Priority: = " + priority + "]"); } public void setMessage(String newText, int newPriority) { text = newText; priority = newPriority; } public static void copyright() { System.out.println("CMSC 131 Copyright 2004"); } public static void main(String[] args) { // Default constructor MessageTwo firstMessage = new MessageTwo(); firstMessage.display(); MessageTwo secondMessage = new MessageTwo("Package Delivered", 10); secondMessage.display(); MessageTwo thirdMessage = new MessageTwo("Package Delivered", 10); if (secondMessage.same(thirdMessage)) { System.out.println("Messages are equivalent"); } else { System.out.println("Messages are not equivalent"); } System.out.println("Total Instances: " + MessageTwo.getTotal()); } }