Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In Java: Develop a program to maintain a list of homework assignments. When an a

ID: 3788809 • Letter: I

Question

In Java:

Develop a program to maintain a list of homework assignments. When an assignment is assigned, add it to the list, and when it is completed, remove it from the list. You should keep track of the due date. Your program should provide the following services:

1. Add a new assignment.
2. Remove an assignment.
3. Provide a list of the assignments in the order they were assigned.
4. Find the assignment with the earliest due date.


---> In JAVA please

---> Better to use ArrayList or LinkedList???

Explanation / Answer

We use Array List.

import java.util.*;
public class Assignments_List
{
   static Scanner input = new Scanner(System.in);
   public static void main (String[] args)
   {
        int setIndex, setVal, AddIndex, AddAssignmnt, remIndex;
       ArrayList AssignmntList = new ArrayList();
       for (int i = 1; i < 11; i++)
       {
           AssignmntList.add(i); /add index
       }  
       System.out.println(" homework assignment program");
       //Setter methods
       System.out.println("Which element:");
       setIndex = input.nextInt();
       System.out.println("Which integer value to set to:");
       setVal = input.nextInt();
          
       // to insert assignments into list
       System.out.println(" ---insert value---");
       System.out.println("After which element:");
       AddIndex = input.nextInt();
       System.out.println("Which integer value to insert:");
       AddAssignmnt = input.nextInt();
      
       // to remove assignments form the program list
       System.out.println(" ---remove operation---");
       System.out.println("which element:");
       remIndex = input.nextInt();
       AssignmntList.set(setIndex, setVal);
       AssignmntList.add(AddIndex, AddAssignmnt);
       AssignmntList.remove(remIndex);

  
       // to updated the array list
       System.out.println(" The updated full list is:");
      
       for (int i = 0; i < AssignmntList.size(); i++)
       {
       System.out.println(AssignmntList.get(i));

       }
             
                    
       /*for (counter = 0; counter < items.length; counter++)
       {
           items[counter] = input.nextInt();
       }*/
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote