<> Comparable Method - methodName: String -priority: int + Method() + Method(methodName: String, priority: int) + abstract specificWay(): void + Getters and setters for all fields compareTo(otherMethod: Method): int + toString(): String ReadMethod - language: String + ReadMethod() + ReadMethod(methodName: String, priority: int, language: String) + specificWay(): void + Getters and setters for language + toString(): String Part 1.1. Implement the abstract class Method implements Comparable interface according to its UML diagram. Add comments stating where data fields, constructors, toString(), and other methods are (if any). Neither method should have an empty body unless abstract methods. 1. two constructors (default and the constructor with all fields) 2. getters and setters for all fields (methodName and priority). 3. toString() method: modify by yourself to match the example output. 4. Abstract method void specificWay(). 5. Implement compara To(Method otherMethod) to compare different objects by priority. Part 1.2. Implement the public class ReadMethod extends Method according to its UML diagram. Add comments stating where data fields, constructors, toString(), and other methods are (if any). Neither method should have an empty body unless abstract methods. 1. One additional field: String language. 2. two constructors(default and the constructor with all fields) including language and the fields in the superclass. 3. getters and setters for language. 4. toString() method: modify by yourself to match the example output. 5. Implement specificWay (): print: "Read loudly in " + language. Part 1.3. Write a main() method inside of the ReadMethod class, having the following: 1. Create a ReadMethod object m1 with method="Reading", priority=30, language="English" 2. Create a ReadMethod object m2 with method="Reading", priority=42, language="Spanish" 3. Test comparaTo() using m1 and m2. 4. Test specific Way() using m1 and m2 5. Print m1 and m2 using toString() Example output: Read loudly in English Read loudly in Spanish methodName=Reading, priority=30, language=English methodName=Reading, priority=40, language=Spanish 1
<> Comparable Method - methodName: String -priority: int + Method() + Method(methodName: String, priority: int) + abstract specificWay(): void + Getters and setters for all fields compareTo(otherMethod: Method): int + toString(): String ReadMethod - language: String + ReadMethod() + ReadMethod(methodName: String, priority: int, language: String) + specificWay(): void + Getters and setters for language + toString(): String Part 1.1. Implement the abstract class Method implements Comparable interface according to its UML diagram. Add comments stating where data fields, constructors, toString(), and other methods are (if any). Neither method should have an empty body unless abstract methods. 1. two constructors (default and the constructor with all fields) 2. getters and setters for all fields (methodName and priority). 3. toString() method: modify by yourself to match the example output. 4. Abstract method void specificWay(). 5. Implement compara To(Method otherMethod) to compare different objects by priority. Part 1.2. Implement the public class ReadMethod extends Method according to its UML diagram. Add comments stating where data fields, constructors, toString(), and other methods are (if any). Neither method should have an empty body unless abstract methods. 1. One additional field: String language. 2. two constructors(default and the constructor with all fields) including language and the fields in the superclass. 3. getters and setters for language. 4. toString() method: modify by yourself to match the example output. 5. Implement specificWay (): print: "Read loudly in " + language. Part 1.3. Write a main() method inside of the ReadMethod class, having the following: 1. Create a ReadMethod object m1 with method="Reading", priority=30, language="English" 2. Create a ReadMethod object m2 with method="Reading", priority=42, language="Spanish" 3. Test comparaTo() using m1 and m2. 4. Test specific Way() using m1 and m2 5. Print m1 and m2 using toString() Example output: Read loudly in English Read loudly in Spanish methodName=Reading, priority=30, language=English methodName=Reading, priority=40, language=Spanish 1
Chapter1: A First Program Using C#
Section: Chapter Questions
Problem 12RQ
Related questions
Question

Transcribed Image Text:<<interface>>
Comparable<Method>
Method
- methodName: String
-priority: int
+ Method()
+ Method(methodName: String, priority: int)
+ abstract specificWay(): void
+ Getters and setters for all fields
compareTo(otherMethod: Method): int
+ toString(): String
ReadMethod
- language: String
+ ReadMethod()
+ ReadMethod(methodName: String,
priority: int, language: String)
+ specificWay(): void
+ Getters and setters for language
+ toString(): String
Part 1.1. Implement the abstract class Method implements Comparable<Method> interface according to its UML
diagram. Add comments stating where data fields, constructors, toString(), and other methods are (if
any). Neither method should have an empty body unless abstract methods.
1. two constructors (default and the constructor with all fields)
2. getters and setters for all fields (methodName and priority).
3. toString() method: modify by yourself to match the example output.
4. Abstract method void specificWay().
5. Implement compara To(Method otherMethod) to compare different objects by priority.

Transcribed Image Text:Part 1.2. Implement the public class ReadMethod extends Method according to its UML diagram. Add comments
stating where data fields, constructors, toString(), and other methods are (if any). Neither method should have
an empty body unless abstract methods.
1. One additional field: String language.
2. two constructors(default and the constructor with all fields) including language and the fields in the
superclass.
3. getters and setters for language.
4. toString() method: modify by yourself to match the example output.
5. Implement specificWay (): print: "Read loudly in " + language.
Part 1.3. Write a main() method inside of the ReadMethod class, having the following:
1. Create a ReadMethod object m1 with method="Reading", priority=30, language="English"
2. Create a ReadMethod object m2 with method="Reading", priority=42, language="Spanish"
3. Test comparaTo() using m1 and m2.
4. Test specific Way() using m1 and m2
5. Print m1 and m2 using toString()
Example output:
Read loudly in English
Read loudly in Spanish
methodName=Reading, priority=30, language=English
methodName=Reading, priority=40, language=Spanish
1
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning