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...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.text.ParseException; import java.util.*; public class SJF { public static...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.text.ParseException; import java.util.*; public class SJF { public static void readFromFile() throws IOException { BufferedReader bufReader = new BufferedReader(new FileReader("processes.txt")); ArrayList<String> listOfLines = new ArrayList<>(); String line = bufReader.readLine(); while (line != null) { listOfLines.add(line); line = bufReader.readLine(); } bufReader.close(); System.out.println("Content of ArrayLiList:"); // split by new line int num = 0; for (String line1 : listOfLines) { String line2[] = line1.split(","); // int burstTime = Integer.parseInt(line2[3].trim()); // String retrival = listOfLines.get(0); System.out.println("...
import java.util.Scanner; public class AroundTheClock {    public static void main(String[] args)    {       ...
import java.util.Scanner; public class AroundTheClock {    public static void main(String[] args)    {        Scanner input = new Scanner(System.in);        int departureTime = input.nextInt();        int travelTime = input.nextInt();        int arrivalTime;            departureTime =12;            departureTime = 0;            arrivalTime = (int) (departureTime + travelTime);            (arrivalTime = (arrivalTime >=12));            if (arrivalTime = arrivalTime %12)            {            System.out.println(arrivalTime);...
/* 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.Scanner; import java.util.Random; public class DiceRoll {    public static final int SIDES = 6;...
import java.util.Scanner; import java.util.Random; public class DiceRoll {    public static final int SIDES = 6;    public static void main(String[] args) {        // TODO Auto-generated method stub        System.out.println("Enter the number of times a 6 sided die should be rolled ");        Scanner keyboard = new Scanner(System.in);        Random r = new Random();               int times = keyboard.nextInt();        boolean valid = false;        while(!valid) {           ...
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) {       ...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT