Java Program 3 making a printlogger and adding another class

Java Program 3 (making a printlogger and adding another class to existing project)

Here are the classes \"Course\" and \"Note\"

package p2;

public class Course {
  
// class fields
private String code; // course code, such as \"EE333\"
private String name; // course name, such as \"Engineering Programming w/ Objects\"
public Note notes[]; // attached note of a course
private int noteSize; // size of the note by lines
  
// construct a Course with a code and a name, i.e. a course constructor
public Course(String code, String name) {
this.code = code;
this.name = name;
notes = new Note[5];
noteSize = 0;
}
  
// get and return the course code
public String getCode() {
return code;
}
  
// add note method
public void add(Note note) {
if (noteSize < 5)
notes[noteSize++] = note;
}
  
// get and return the course name
public String getName() {
return name;
}
  
// get and return the size of the note
public int getCount() {
return noteSize;
}
  
// get and return the i\'th line of the note
public Note get(int i) {
if (i < notes.length)
return notes[i];
else
return null;
}
  
// create a string of the course name and course code
@Override
public String toString() {
return code + \": \" + name + \" \";
}
  
}

*****************************************************************

package p2;

public class Note {
  
// class fields
private String title; // title of note
private String lines[]; // contents of a note, line by line
private int UID; // UID of note (starts at 10000)
private int lineSize; // size of a line within a note
private static int count; // i\'th line of the note
  
// construct a note with a title
public Note(String title) {
this.title = title;
this.UID = count++;
lines = new String[10];
lineSize = 0;
}
  
// delete line method
public void delete(int i) {
if (i < 10) {
lines[i] = \"\";
lineSize--;
}
}
  
// append string method
public void append(String line) {
if (lineSize < 10) {
lines[lineSize++] = line;
}
}
  
public void setTitle(String newTitle) {
this.title = newTitle;
}

public int getUID() {
return UID;
}
  
public String getTitle() {
return title;
}

public int getCount() {
return lineSize;
}

public String getLine(int i) {
if(i<lineSize)
return lines[i];
else
return \"\";
}

@Override
public String toString() {
return \"Note \" + UID + \": \" + title;
}
}

Task Create hem an item, make Note a subclass of item, PrintLogger, begin using JUnit The purpose of this task is to improve the LMS Course modeling by Creating a PrintLogger to do IO Create a Item class as an superclass that represents items of a class Update course to support changes addition to building some new capabilities, we will be learning to update/maintain a code base and the value of nit testing. Create Item superclass Hint: You may wish to try the \"refactor I extract superclass NetBeans option on the Notes class The Item class Captures the essence of an item in the course Give each item constructed a UID with the first one starting at 10000 Constructor Ite (String Title) create an item with a given title, create a UID. If nul is suppled for the title, choose an tite to use so that all items have titles. Query int getUID() return the UID of this item string getTitle() retums the title of the item (a line of text) string getType() returns a string representing the type, in this case Iten String to string C) returns \"otype (kuid>):

Solution

package p2;

public class Course {
  
// class fields
private String code; // course code, such as \"EE333\"
private String name; // course name, such as \"Engineering Programming w/ Objects\"
public Note notes[]; // attached note of a course
private int noteSize; // size of the note by lines
  
// construct a Course with a code and a name, i.e. a course constructor
public Course(String code, String name) {
this.code = code;
this.name = name;
notes = new Note[5];
noteSize = 0;
}
  
// get and return the course code
public String getCode() {
return code;
}
  
// add note method
public void add(Note note) {
if (noteSize < 5)
notes[noteSize++] = note;
}
  
// get and return the course name
public String getName() {
return name;
}
  
// get and return the size of the note
public int getCount() {
return noteSize;
}
  
// get and return the i\'th line of the note
public Note get(int i) {
if (i < notes.length)
return notes[i];
else
return null;
}
  
// create a string of the course name and course code
@Override
public String toString() {
return code + \": \" + name + \" \";
}
  
}

*****************************************************************

package p2;

public class Note {
  
// class fields
private String title; // title of note
private String lines[]; // contents of a note, line by line
private int UID; // UID of note (starts at 10000)
private int lineSize; // size of a line within a note
private static int count; // i\'th line of the note
  
// construct a note with a title
public Note(String title) {
this.title = title;
this.UID = count++;
lines = new String[10];
lineSize = 0;
}
  
// delete line method
public void delete(int i) {
if (i < 10) {
lines[i] = \"\";
lineSize--;
}
}
  
// append string method
public void append(String line) {
if (lineSize < 10) {
lines[lineSize++] = line;
}
}
  
public void setTitle(String newTitle) {
this.title = newTitle;
}

public int getUID() {
return UID;
}
  
public String getTitle() {
return title;
}

public int getCount() {
return lineSize;
}

public String getLine(int i) {
if(i<lineSize)
return lines[i];
else
return \"\";
}

@Override
public String toString() {
return \"Note \" + UID + \": \" + title;
}
}

Java Program 3 (making a printlogger and adding another class to existing project) Here are the classes \
Java Program 3 (making a printlogger and adding another class to existing project) Here are the classes \
Java Program 3 (making a printlogger and adding another class to existing project) Here are the classes \
Java Program 3 (making a printlogger and adding another class to existing project) Here are the classes \
Java Program 3 (making a printlogger and adding another class to existing project) Here are the classes \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site