Define the following method: public static void printRecord(StringbookName, Stri
ID: 3611104 • Letter: D
Question
Define the following method:public static void printRecord(StringbookName, String author, int year)
This method takes in input the name of the book,the name of the author, and the name of the year of pubblication.If invoked with "Twilight", "Meyer" and 2005, it print thisinformation on the terminal window under the following form :
Twilight by Meyer, published in 2005
In the main() method, call method printRecord() with values:
Twilight Mayer 2005
Harry Potter J.KRowling 1997
Explanation / Answer
import java.io.*; import java.util.*; import java.lang.*; public class Print { public static void printRecord(String bookName, String author, intyear) { System.out.println(bookName + " by " + author +", published in " +year); } public static void main(String [] arg) { printRecord("Twilight", "Meyer" , 2005); System.out.println(); printRecord("Harry Potter", "J.K Rowling",1997); }//end of main }//end of class
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.