Microsoft Visual C#
Microsoft Visual C#
7th Edition
ISBN: 9781337102100
Author: Joyce, Farrell.
Publisher: Cengage Learning,
Bartleby Related Questions Icon

Related questions

Question
<<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.
expand button
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.
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
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning