1) Review the material about interfaces 2) Complete the following programming as
ID: 3870538 • Letter: 1
Question
1) Review the material about interfaces
2) Complete the following programming assignment:
Design a Java interface called Priority that includes two methods: setPriority and getPriority. The interface should define a way to establish numeric priority among a set of objects. Design and implement a class called Task that represents a task (such as a to-do-list) that implements the Priority interface. Create a driver class to exercise some Task objects.
This is a fairly open-ended project, so you can be as simple or complex as you would like. The only requirement is that you create an interface, a class that implements that interface, and a driver class. Think carefully about your design and use good object oriented principles in your implementation.
Submission requirements:
• Include your name as a comment at the top of each source code file
• Make good use of whitespace/comments to make your implementation clear. • Include the following in a well-formatted .doc, .pdf, or .txt file
• A brief description your implementation • Sample output
• Your Priority interface
• Your Task class.
• Upload a zip file with your code. The easiest thing is to zip your entire project directory. Do not use .rar.
• Include your first and last name in the .zip filename
• Upload your implementation/output document to Canvas separately from your code. You can
turn in a hard copy if you prefer.
Be prepared to demo your project in class.
Explanation / Answer
public interface Priority
{
public void setPriority(int level);
public int getPriority();
int MIN_PRIORITY = 1;
int MAX_PRIORITY = 6;
}
public class Task implements Priority {
private int priority;
public void setPriority(int MIN_PRIORITY){
priority = MIN_PRIORITY;
}
public int getPriority(){
return priority;
}
}
import java.util.Scanner;
public class TaskDriver
{
public static void main (String [] args)
{
Scanner scan = new Scanner (System.in);
Priority priority1 = new priority ("Please enter the name of the 1st task: ");
S = scan.nextLine();
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.