- 
      
- 
        Save damithc/c27161d3472ca2e2fe0fba923c81fc77 to your computer and use it in GitHub Desktop. 
| import java.util.*; | |
| public class Manage_Task { | |
| private String description; | |
| private boolean important; | |
| private int i; // used to count tasks | |
| String pastDescription[] = new String[10]; // a list of past descriptions | |
| public Manage_Task(String d) { | |
| this.description = d; | |
| if (!d.isEmpty()) | |
| // set as important | |
| this.important = true; | |
| } | |
| public String getAsXML() { return "<task>"+description+"</task>"; } | |
| public void printingDescription(){ System.out.println(this); } | |
| public String toString() { return description; } | |
| } | 
Line 18: As good coding practice, there should be a spacing after method name and first {. Statement should be changed to public void printingDescription() { System.out.println(this); }
Line 16: function name should be getAsXml() instead as only the first letter of the acronym should be capitalised
Line 7: String pastDescription[] should be String pastDescriptions[]. As good coding practices we should use plural forms for describing a collection of items
Line 5: private boolean important should be changed to isImportant, to indicate boolean variables as a question for better readability.
Line 3: The naming of a class should be in PascalCase format and a noun as a form of good coding naming standard. The name of the class could be changed to TaskManager instead of Manage_Task.
Line 10, 11, 13: Basic indentation should be 4 spaces instead of 2.
Lines 3,9 Manage_Task should be renamed as Class/enum names must be nouns and written in PascalCase.
Line 5, private boolean important, important should be changed to isImportant as Boolean variables/methods should be named to sound like booleans
Comments should be indented relative to their position in the code.
Method definitions should have the following form:
public void someMethod() throws SomeException {
...
}
Line 7: It should be String[] pastDescriptions instead of String pastDescription[]. Array specifiers must be attached to the type not the variable, and it should be plural form as stated by one of the comments above.
Line 11: As a good practice the
ifblock should be enclosed in a pair of bracesif (cond) {}regardless of the LOC inside