Question: Java polymorphism and inheritance Task: Create an interface named Comparison whose method can be used to compare two Time objects. The methods will include isGreater,

Java polymorphism and inheritance  Task: Create an interface named Comparison whose method can be used to compare two Time objects. The methods will include isGreater, isLess, and isEqual. Create another class that will implement these methods. (Compare two time objects, inputted by the user) *Fix my code *Add comments  Source Code: import java.util.*; interface Comparison { boolean isGreater(Time x, Time y); boolean isLess(Time x,Time y); boolean isEqual(Time x, Time y); } public class Time implements Comparison { int am, pm; public boolean isGreater(Time x, Time y) { if (am > pm) { System.out.print("True"); } else System.out.print("False"); } public boolean isLess(Time x,Time y) { if (am < pm) { System.out.print("True"); } else System.out.print("False"); } public boolean isEqual(Time x, Time y) { } } public class Main { public static void main(String[] args) { System.out.println("Enter your first number: "); int x = new Time(); System.out.println("Enter your second number: "); int y = new Time(); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!