in java need uml diagram
import java.util.ArrayList; import java.util.*; public class TodoList { String date=""; String work=""; boolean completed=false; boolean important=false; public TodoList(String a,String b,boolean c,boolean d){ this.date=a; this.work=b; this.completed=c; this.important=d; } public boolean isCompleted(){ return this.completed; } public boolean isImportant(){ return this.important; } public String getDate(){ return this.date; } public String getTask(){ return this.work; } } class Main{ public static void main(String[] args) { ArrayList<TodoList> t1=new ArrayList<TodoList>(); TodoList t2=null; Scanner s=new Scanner(System.in); int a; String b="",c=""; boolean d,e; char g; do{ System.out.println("1 Add a Task\n2 Show All Task\n3 Show Completed Task\n4 Delete a task"); a=s.nextInt(); switch(a){ case 1: System.out.println("enter the date"); b=s.next(); System.out.println("enter the task"); c=s.next(); System.out.println("enter the task is important true/false"); e=s.nextBoolean(); System.out.println("enter the task is completed true/false"); d=s.nextBoolean(); t2=new TodoList(b,c,d,e); t1.add(t2); break; case 2: for(int i=0;i<t1.size();i++) { b=t1.get(i).getDate(); c=t1.get(i).getTask(); d=t1.get(i).isCompleted(); e=t1.get(i).isImportant(); System.out.println("Date: "+b+"\tTask: "+c+"\tCompleted: "+d+"\tImportant: "+e); } break; case 3: for(int i=0;i<t1.size();i++) { b=t1.get(i).getDate(); c=t1.get(i).getTask(); d=t1.get(i).isCompleted(); e=t1.get(i).isImportant(); if(d){ System.out.println("Date: "+b+"\tTask: "+c+"\tCompleted: "+d+"\tImportant: "+e); } } break; case 4: System.out.println("Enter task number to delete"); int f=s.nextInt(); for(int i=f;i<t1.size()-1;i++){ t1.set(i,t1.get(i+1)); } break; default: System.out.println("Error"); break; } System.out.println("Continue: Y/N"); g=s.next().charAt(0); }while((g=='y')||(g=='Y')); } }
There will be two independent classes in the UML diagram one is TodoList and other one is Main as no classes are using each other expect the function main inside the Main is using the TodoList but that doesn't comes under UML diagram as shown:
Get Answers For Free
Most questions answered within 1 hours.