How to write, in Java, a note-taking application which allows people to record notes and search for given notes by keyword - a public class Note (with instance variables subject and content) and a separate class Journal which will maintain a list of Note objects together with the name of the person owning the journal. Tons of thanks.
//NotesTaking.java
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collector;
import java.util.stream.Collectors;
public class NotesTaking {
public static void main(String[] args) {
//Scanners to get user inputs
Scanner in1 = new
Scanner(System.in);
Scanner in2 = new
Scanner(System.in);
Scanner in3 = new
Scanner(System.in);
Scanner in4 = new
Scanner(System.in);
Scanner in5 = new
Scanner(System.in);
//variables to store the values
from Scanners
int choice;
String subject;
String content;
String jounalName;
String search;
//List to store Notes List
List<Note> noteList = new
ArrayList<Note>();
System.out.println("Enter number
of notes to record : ");
choice = in1.nextInt(); //number of
notes to record
//loop over number of notes to
record
while (choice-- > 0) {
System.out.println("Enter subject name for notes : ");
//enter subject
for notes
subject =
in2.nextLine();
System.out.println("Enter content for notes : ");
//enter content
for notes
content =
in3.nextLine();
//create note
object
Note note = new
Note(subject, content);
//add note to
noteList
noteList.add(note);
}
System.out.println("Enter Journal
name : ");
//enter journal name
jounalName = in4.nextLine();
//create journal object
Journal journal = new
Journal(jounalName, noteList);
System.out.println("Enter Search
keyword : ");
//enter search keyword
search = in5.nextLine();
//filter over the journal noteList
that contains the search keyword
List<Note> searchList =
journal.getNoteList().stream().filter(note ->
note.getSubject().contains(search) ||
note.getContent().contains(search)).collect(Collectors.toList());
//print note object
for(Note note : searchList) {
System.out.println("Subject : "+note.getSubject() + "\nContent :
"+note.getContent() );
}
//close scanners
in1.close();
in2.close();
in3.close();
in4.close();
in5.close();
}
}
//Note.java
public class Note {
private String subject;
private String content;
public Note(String subject, String content) {
this.subject = subject;
this.content = content;
}
public Note() {}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
//Journal.java
import java.util.List;
public class Journal {
private String name;
private List<Note> noteList;
public Journal(String name, List<Note> noteList)
{
this.noteList = noteList;
this.name = name;
}
public List<Note> getNoteList() {
return noteList;
}
public void setNoteList(List<Note> noteList)
{
this.noteList = noteList;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
How to write, in Java, a note-taking application which allows people to record notes and search...
****Here is the assignment **** Purpose: To write an Object-Oriented application that creates a Java class with several instance variables, a constructor to initialize the instance variables, several methods to access and update the instance variables’ values, along with other methods to perform calculations. Also, write a test class that instantiates the first class and tests the class’s constructor and methods. Details: Create a class called Rectangle containing the following: Two instance variables, An instance variable of type double used...
*****************************In Java***************************************In Java***********************************In Java************************* In this problem, you will implement various algorithms operating on binary search trees. We have provided with you a standard implementation of a generic BST in BinarySearchTree.java. Note that this class is an abstract class, which means that some of its methods are not implemented. In previous assignments, you have implemented interfaces which specified methods that you needed to write. Very similarly, an abstract class is a class with some unimplemented methods (it can be thought...
In Java. Write a GUI contact list application. The program should allow you to input names and phone numbers. You should also be able to input a name and have it display the previously entered phone number. The GUI should look something like the following, although you are welcome to format it in any way that works. This should be a GUI application with a JFrame. The program should contain two arrays of Strings. One array will contain a list...
JAVA Write a program which will read a text file into an ArrayList of Strings. Note that the given data file (i.e., “sortedStrings.txt”) contains the words already sorted for your convenience. • Read a search key word (i.e., string) from the keyboard and use sequential and binary searches to check to see if the string is present as the instance of ArraryList. • Refer to “SearchInt.java” (given in “SearchString.zip”) and the following UML diagram for the details of required program...
1-Suppose you write an application in which one class contains code that keeps track of the state of a board game, a separate class sets up a GUI to display the board, and a CSS is used to control the stylistic details of the GUI (for example, the color of the board.) This is an example of a.Duck Typing b.Separation of Concerns c.Functional Programming d.Polymorphism e.Enumerated Values 2-JUnit assertions should be designed so that they a.Fail (ie, are false) if...
Java Project In Brief... For this Java project, you will create a Java program for a school. The purpose is to create a report containing one or more classrooms. For each classroom, the report will contain: I need a code that works, runs and the packages are working as well The room number of the classroom. The teacher and the subject assigned to the classroom. A list of students assigned to the classroom including their student id and final grade....
This assignment shpuld be code in java. Thanks Overview In this assignment you will write a program that will model a pet store. The program will have a Pet class to model individual pets and the Assignment5 class will contain the main and act as the pet store. Users will be able to view the pets, make them age a year at a time, add a new pet, and adopt any of the pets. Note: From this point on, your...
JAVA How to add array to develop a contact list application for the person class objects developed in this code? The application will include functionality to add, remove, sort and search the contact list. You should also include a method to output the contents of a contact searched for, and also to output the entire list. The code: package BankProg; public class personal { private String facebook; public personal() { } public personal(String facebook) { this.facebook...
In Java, Write a class encapsulating a restaurant,which inherits from Store. A restaurant has the following additional attributes: how many people are served every year and the average price per person. code the constructor, accessors, mutators, toString and equals method of the new subclass; also code a method returning the average taxes per year. You also need to include a client class to test your code for both the parent class and the subclass. Code for Store below(Super class aka...
Please Write the following program in c# You are to write an application which will create a company, add agents (their name, ID, and weekly sales) to that company, and printout the details of all agents in the company. The application will contain three classes: Agent.cs, Company.cs, and CompanyTest.cs (this class is already provided). Flow of the application: The CompanyTest class creates an object of the Company class and reserves space for five agents. At this point if you call...