Question

in java need uml diagram import java.util.ArrayList; import java.util.*; public class TodoList { String date=""; String...

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'));
    }
}

Homework Answers

Answer #1

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:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
<<<<<<<< I need only the UML diagram for ALL classes.Java???????????? public class House {    private...
<<<<<<<< I need only the UML diagram for ALL classes.Java???????????? public class House {    private int houseNumber;    private int bedrooms;    private int sqFeet;    private int year;    private int cost;    public House(int houseNumber,int bedrooms,int sqFeet, int year, int cost)    {        this.houseNumber = houseNumber;        this.bedrooms = bedrooms;        this.sqFeet = sqFeet;        this.year = year;        this.cost = cost;    }    public int getHouseNumber()    {        return houseNumber;    }   ...
please fix code to delete by studentname import java.util.Scanner; public class COurseCom666 {     private String...
please fix code to delete by studentname import java.util.Scanner; public class COurseCom666 {     private String courseName;     private String[] students = new String[1];     private int numberOfStudents;     public COurseCom666(String courseName) {         this.courseName = courseName;     }     public String[] getStudents() {         return students;     }     public int getNumberOfStudents() {         return numberOfStudents;     }     public void addStudent(String student) {         if (numberOfStudents == students.length) {             String[] a = new String[students.length + 1];            ...
Provide A UML for the Following CODE public class Employee{ public String strName, strSalary; public Employee(){...
Provide A UML for the Following CODE public class Employee{ public String strName, strSalary; public Employee(){    strName = " ";    strSalary = "$0";    } public Employee(String Name, String Salary){    strName = Name;    strSalary = Salary;    } public void setName(String Name){    strName = Name;    } public void setSalary(String Salary){    strSalary = Salary;    } public String getName(){    return strName;    } public String getSalary(){    return strSalary;    } public String...
[Java] I'm not sure how to implement the code. Please check my code at the bottom....
[Java] I'm not sure how to implement the code. Please check my code at the bottom. In this problem you will write several static methods to work with arrays and ArrayLists. Remember that a static method does not work on the instance variables of the class. All the data needed is provided in the parameters. Call the class Util. Notice how the methods are invoked in UtilTester. public static int min(int[] array) gets the minimum value in the array public...
import java.util.Scanner; public class FindMinLength { public static int minLength(String[] array) { int minLength = array[0].length();...
import java.util.Scanner; public class FindMinLength { public static int minLength(String[] array) { int minLength = array[0].length(); for (int i = 0; i < array.length; i++) { if (array[i].length() < minLength) minLength = array[i].length(); } return minLength; } public static void main(String[] args) { Scanner in = new Scanner(System.in); String[] strings = new String[50]; for (int i = 0; i < strings.length; i++) { System.out.print("Enter string " + (i + 1) + ": "); strings[i] = in.nextLine(); } System.out.println("Length of smallest...
/* Program Name: BadDate.java Function: This program determines if a date entered by the user is...
/* Program Name: BadDate.java Function: This program determines if a date entered by the user is valid. Input: Interactive Output: Valid date is printed or user is alerted that an invalid date was entered. */ import java.util.Scanner; public class BadDate { public static void main(String args[]) { // Declare variables Scanner userInput = new Scanner (System.in); String yearString; String monthString; String dayString; int year; int month; int day; boolean validDate = true; final int MIN_YEAR = 0, MIN_MONTH = 1,...
import java.util.Stack; import java.util.Scanner; class Main { public static void main(String[] args)    {       ...
import java.util.Stack; import java.util.Scanner; class Main { public static void main(String[] args)    {        Stack<Integer> new_stack = new Stack<>();/* Start with the empty stack */        Scanner scan = new Scanner(System.in);        int num;        for (int i=0; i<10; i++){//Read values            num = scan.nextInt();            new_stack.push(num);        }        int new_k = scan.nextInt(); System.out.println(""+smallerK(new_stack, new_k));    }     public static int smallerK(Stack s, int k) {       ...
Consider the following Java program : public static void main (string args [ ]) { int...
Consider the following Java program : public static void main (string args [ ]) { int result, x ; x = 1 ; result = 0; while (x < = 10) { if (x%2 == 0) result + = x ; + + x ; } System.out.println(result) ; } } Which of the following will be the output of the above program? A. 35 B. 30 C. 45 D. 35 2. public static void main(String args[]) { int i =...
Stack2540Array import java .io .*; import java . util .*; public class Stack2540Array { int CAPACITY...
Stack2540Array import java .io .*; import java . util .*; public class Stack2540Array { int CAPACITY = 128; int top ; String [] stack ; public Stack2540Array () { stack = new String [ CAPACITY ]; top = -1; } 1 3.1 Implement the stack ADT using array 3 TASKS public int size () { return top + 1; } public boolean isEmpty () { return (top == -1); } public String top () { if ( top == -1)...
JAVA public class Purchase { private String name; private int groupCount; //Part of price, like the...
JAVA public class Purchase { private String name; private int groupCount; //Part of price, like the 2 in 2 for $1.99. private double groupPrice; //Part of price, like the $1.99 in 2 for $1.99. private int numberBought; //Total number being purchased. public Purchase () { name = "no name"; groupCount = 0; groupPrice = 0; numberBought = 0; } public Purchase (String name, int groupCount, double groupPrice, int numberBought) { this.name = name; this.groupCount = groupCount; this.groupPrice = groupPrice; this.numberBought...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT