1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Rasek [7]
3 years ago
9

Write a class named Book that has fields to hold the following data: Title Author Year published ISBN number In the Book class,

also include A mutator method for each field to set the value for the field An accessor method for each field to get the value for the field Write a separate demo program that Utilizies the class by creating three instances of the class.
Computers and Technology
1 answer:
Hatshy [7]3 years ago
3 0

Answer:

public class Book {

   private String title;

   private String author;

   private int yearPublished;

   private long ISBN;

   //The Constructor for all the feilds

   public Book(String title, String author, int yearPublished, long ISBN) {

       this.title = title;

       this.author = author;

       this.yearPublished = yearPublished;

       this.ISBN = ISBN;

   }

   //Mutator methods (set) to Set values of all the fields

   public void setTitle(String title) {

       this.title = title;

   }

   public void setAuthor(String author) {

       this.author = author;

   }

   public void setYearPublished(int yearPublished) {

       this.yearPublished = yearPublished;

   }

   public void setISBN(long ISBN) {

       this.ISBN = ISBN;

   }

   //Accessor Methods (getters) for all the feilds

   public String getTitle() {

       return title;

   }

   public String getAuthor() {

       return author;

   }

   public int getYearPublished() {

       return yearPublished;

   }

   public long getISBN() {

       return ISBN;

   }

}

// The Demo Class creating three instances of this class

class BookDemo{

   public static void main(String[] args) {

       Book bookOne = new Book("The Lion and the Princess","David A.",2000,12334556);

       Book bookTwo = new Book ("Me and You", "Jane G.", 2001, 4567342);

       Book bookThree = new Book("together forever", "Baneely H.",2019,34666);

   }

}

Explanation:

  • Please pay attention to the comments provided in the solution
  • Using Java Programming Language
  • The class Book is created with the required fields
  • The constructor is created to initialize the values of the fields
  • Getter methods are created
  • Setter Methods are Created
  • A demo Class BookDemo that creates three objects of the Book class is the created (This can be in the same file as the Book class but cannot start with the keyword public or in a separate file with the keyword public class BookDemo)
  • Inside BookDemo class, three instances of the Book class are created and initialized.
You might be interested in
Look at the four schematic symbols shown in the figure above. Each of the symbols is labeled with a number. Which of the followi
ladessa [460]
The correct answer for the question that is being presented above is this one: "D. Symbol 1 represents a transistor, symbol 2 represents a diode, symbol 3 represents a resistor, and symbol 4 represents a lightbulb." <span>Each of the symbols is labeled with a number. </span>
6 0
4 years ago
Can someone help me with this question, i know all except psuedocode, help me please
Shkiper50 [21]

Answer:

what should I help you

Explanation:

I don't no any thing because I an beginning

7 0
3 years ago
In order for you to make a wireless connection it must first find an availble
erastova [34]
It sounds like you are looking for a network. If a node can not find a network to connect to, then it cannot connect.
7 0
3 years ago
Digital Blank______ track KPIs and CSFs by compiling information from multiple sources and tailoring it to meet user needs. Mult
aleksklad [387]

Digital Dashboard track KPIs and CSFs by compiling information from multiple sources and tailoring it to meet user needs.

<h3>What are digital dashboard?</h3>

This is known to be a kind of  an analysis tool that helps a lot of business men and women to be able to examine and analyze their most vital data sources in real time.

Note that Digital Dashboard track KPIs and CSFs by compiling information from multiple sources and tailoring it to meet user needs.

Learn more about digital dashboard from

brainly.com/question/14383144

#SPJ1

3 0
2 years ago
Which below best describes JavaScript? *
marysya [2.9K]

Answer:

it is a programing languwage that is useualy used to program visual or text based applications

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • A document repository is down when you attempt to access it. which isa principle is being violated?
    13·1 answer
  • Suppose a worker needs to process 100 items. the time to process each item is exponentially distributed with a mean of 2 minutes
    5·1 answer
  • What is looping in QBASIC​
    9·1 answer
  • Can you please help me by sending a proposal onnanotechnology in networking applications
    8·1 answer
  • Which of the following is a variable expense for many adults?
    11·2 answers
  • A company operates on two types of servers: 2 large servers (L) and 4 smaller servers (S), with a combined total of 64GB RAM. Th
    9·1 answer
  • The model for Diminishing Marginal Utility is ______ in nature.
    12·1 answer
  • A technician has been asked to upgrade a processor and needs to do some research. The computer is just a couple of years old. Wh
    13·1 answer
  • What feature allows you to access previous copies of a document on OneDrive?
    15·2 answers
  • What are the three parts of a camera
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!