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
sweet [91]
1 year ago
8

Given the following class, Book, Write code for the following:

Computers and Technology
1 answer:
Yuri [45]1 year ago
7 0

Using the knowledge in computational language in JAVA it is possible to write a code that can organize the books in price and author classes.

<h3>Writing the code in JAVA we have:</h3>

<em>class Book{</em>

<em>    private int price;</em>

<em>    private String author;</em>

<em>    public Book(int p){</em>

<em>        price=p;</em>

<em>    }</em>

<em>    public Book(Book b){</em>

<em>        price=b.price;</em>

<em>        author=b.author;</em>

<em>    }</em>

<em>    public int getPrice(){</em>

<em>        return price;</em>

<em>    }</em>

<em>    public void setAuthor(String a){</em>

<em>        author=a;</em>

<em>    }</em>

<em>    public String toString(){</em>

<em>        return author+" "+Integer.toString(price);</em>

<em>    }</em>

<em>}</em>

<em>public class Main</em>

<em>{</em>

<em> public static void main(String[] args) {</em>

<em>     Book b=new Book(450);</em>

<em>     b.setAuthor("Jack");</em>

<em>     Book b1=new Book(b);</em>

<em>     System.out.println(b1.toString());</em>

<em> }</em>

<em>}</em>

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

#SPJ1

You might be interested in
Savings accounts _____.
klemol [59]
???????????????????????
7 0
3 years ago
Which scenario would benefit most from being set up as a recurring appointment?
sveta [45]
The answer is b. Susan has an appointment with he co-worker on the first Monday of every month. This scenario would benefit from being set up as a recurring appointment, since it requires the same thing to be done every month on the same day. Susan is likely to forget this appointment every month, so a reminder like this would be useful for her. For the other cases, a recurring appointment would not be of much benefit since they do not follow a particular pattern time-wise.
3 0
3 years ago
A(n) _____ converts the programming instructions written by programmers into a language that the computer understands and proces
qaws [65]

Answer: Translator

Explanation:

each instruction written by programmer in another language must be converted (translated) to machine language in order to process, because computer understand only machine language( 0 and 1). that is translator.

8 0
3 years ago
I have a singular monitor that is a TV for my computer. Recently, I took apart my computer and put it back together. When I put
makkiz [27]

your tv should have either a controls are or a setting area there is an option for "game mode" that should work with the HDMI.

4 0
3 years ago
A town government is desinging anew bus system
Kamila [148]

Answer:

Umm what? Are you talking about the type of problem it is? If so it is an optimization problem.

Explanation:

I had something like this for one of my tests and I chose the optimization problem because it finds the values of decision variables that result in a maximum or minimum of a function.

But ion know if it's this that you are talking about

3 0
3 years ago
Other questions:
  • The computer stores a program while the program is running, as well as the data thatthe program is working with, in _____.
    10·1 answer
  • How do I add and accept a friend on this app?
    10·1 answer
  • Software that function as an electronic file cabinet
    7·1 answer
  • Who developed the idea of a universal network?
    11·1 answer
  • Most of the Desktop games contain a backdoor used to test and update the game.
    14·1 answer
  • List 5 differences between monitors and printers​
    14·1 answer
  • What is a disruptive technology? Give an example of an aspect of society that has been impacted by technological change.
    6·1 answer
  • Think about a career you would like to have 10 years from now.
    5·1 answer
  • In what medium do web applications operate?
    8·1 answer
  • Question 12 (5 points)
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!