Hacks

5.1-5.3 Hacks

POPCORN HACKS: 0.2

Create a simple To-Do List that utilizes the following (0.8):

  1. Private and Public Declaration

  2. Constructor

  3. Mutable Array containing To-Do List Items

Make sure to add descriptive comments that are describing your code!

public class TodoList {
    private ArrayList<String> list; //this sets the list with private declaration
    public TodoList() {
        list = new ArrayList<>();
    }
    public ArrayList<String> getList() { //this is to get the list
        return list;
    }
    public void addToList(String todo) { //this lets you add todos to the list
        list.add(todo);
    }

    public void removeFromList(int index) { // lets you remove from the list
        list.remove(index);
    }
    public static void main(String[] args) {
        TodoList list = new TodoList(); // construct the instance of the class
        list.addToList("Eat food"); // adding todos
        list.addToList("Do homework");
        list.addToList("Sleep");
        System.out.println(list.getList());
        list.removeFromList(2); // removing the last todo
        System.out.println(list.getList());
    }
}
TodoList.main(null);
[Eat food, Do homework, Sleep]
[Eat food, Do homework]

5.9-5.10 Hacks

POPCORN HACKS: 0.2

Write a two sentence reflection on the social and ethical implications of programming. (0.8)

In programming legal issues and intellectual property and data privacy are big concerns and programmers need to follow the terms of licensing. Software may have harmful impacts to society and software has changed how people do things like communicate and access information.