Write, compile, and test the MovieQuoteInfo class so that it displays your favorite movie quote, the movie it comes from, the character who said it, and the year of the movie: I GOT IT DONT WATCH AD.

class MovieQuoteInfo {
public static void main(String[] args) {
System.out.println("Rosebud,");
System.out.println("said by Charles Foster Kane");
System.out.println("in the movie Citizen Kane");
System.out.println("in 1941.");
}
}

Respuesta :

Using the knowledge of computational language in JAVA it is possible to write a code that removes your favorite phrase from the movie. It consists of two classes in which one is driver code to test the MovieQuoteInfo class.

Writing code in JAVA:

public class MovieQuoteInfo { //definition of MovieQuoteInfo class

//All the instance variables marked as private

private String quote;

private String saidBy;

private String movieName;

private int year;

public MovieQuoteInfo(String quote, String saidBy, String movieName, int year) { //parameterized constructor

 super();

 this.quote = quote;

 this.saidBy = saidBy;

 this.movieName = movieName;

 this.year = year;

}

//getters and setters

public String getQuote() {

 return quote;

}

public void setQuote(String quote) {

 this.quote = quote;

}

public String getSaidBy() {

 return saidBy;

}

public void setSaidBy(String saidBy) {

 this.saidBy = saidBy;

}

public String getMovieName() {

 return movieName;

}

public void setMovieName(String movieName) {

 this.movieName = movieName;

}

public int getYear() {

 return year;

}

public void setYear(int year) {

 this.year = year;

}

//overriden toString() to print the formatted data

public String toString() {

 String s = quote+",\n";

 s+="said by "+this.saidBy+"\n";

 s+="in the movie "+this.movieName+"\n";

 s+="in "+this.year+".";

 return s;

}

}

Driver.java

public class Driver { //driver code to test the MovieQuoteInfo class

public static void main(String[] args) {

 MovieQuoteInfo quote1 = new MovieQuoteInfo("Rosebud", "Charles Foster Kane", "Citizen Kane", 1941);//Create an object of MovieQuoteInfo class

 System.out.println(quote1); //print its details

}

}

See more about JAVA at brainly.com/question/12975450

#SPJ1

Ver imagen lhmarianateixeira