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
Ainat [17]
3 years ago
9

Write a class named Book containing: Two instance variables named title and author of type String. A constructor that accepts tw

o String parameters. The value of the first is used to initialize the value of title and the value of the second is used to initialize author. A method named toString that accepts no parameters. toString returns a String consisting of the value of title, followed by a newline character, followed by the value of author.
Computers and Technology
1 answer:
andrey2020 [161]3 years ago
3 0

Answer:

The code to this question can be given as:

Code:

public class Book  //define class.  

{

private String title, author;   //define variable.

Book(String a, String b)  //define parameterized constructor.

{

title = a;   //holding value.

author = b;

}

public String toString()  //string function

{

return title + "\n" + author;    //return value.

}

}

Explanation:

In the above java code firstly we declare the class book that name is already given in the question. Then we declare the private variable that datatype is string author and title. Then we declare the parameterized constructor. In the parameterized constructor we use the private variable for hold constructor parameter value. Then we declare the tostring() function in this function we return value of the title and author variable.

You might be interested in
How do you use the Internet? Think about your typical day. When are you using the Internet? For what purposes? What role does it
gladu [14]

Answer:

I would say something like this:

I use the internet mainly for communication, school and all the necessary informations. It has become a routine thing for every person on the planet. People are able to progress in almost all spheres of life. It can link people from all over and create communities.

5 0
4 years ago
What is the similarities between traditional and modernized presentation​
Ivenika [448]

Answer:

“Traditional” refers to those societies or elements of societies that are small-scale, are derived from indigenous and often ancient cultural practices. “Modern” refers to those practices that relate to the industrial mode of production or the development of large-scale often colonial societies.

6 0
2 years ago
3) How ash traditional technology and modern
Fynjy0 [20]

Answer:

While the developed world benefits from the modern explosion of technology, countries like Ethiopia continue to rely on their forefathers' methods for important daily tasks such as farming, cooling, and providing clean water. These activities are often physically challenging, time and energy intensive, and are often carried out by female family members in many such societies. Furthermore, they can damage the local ecology and climate, such as deforestation and soil erosion caused by the use of trees for firewood. Western technologies are often too complicated, expensive, unacceptable, and difficult to maintain in developing societies, so they are of little or no use in these situations.

4 0
3 years ago
How can you create a class without any methods, yet call a method from that class?
Shalnov [3]

Every class has a special method called a constructor which is a function you can call.

7 0
4 years ago
The function below tries to create a list of integers by reading them from a file. The file is expected to have a single integer
Setler [38]

Answer:

Check the explanation

Explanation:

def get_list_of_integers_from_file(filename):

int_list=[]

for line in open(filename).readlines():

try:

int_list.append(int(line))

except:

continue

return int_list

print(get_list_of_integers_from_file('file.txt'))

 

File.txt:

Kindly check the output below.

4 0
3 years ago
Other questions:
  • Which logic gate produces an output of 1 only if both it’s inputs are 0?
    10·2 answers
  • After a file downloads, you can do any of the following except
    13·1 answer
  • - The concept of communication competence suggests there is no single "ideal" or "effective" way to communicate in every situati
    6·2 answers
  • What factors should you consider when buying a hard drive?
    8·1 answer
  • ___operating space means there is a restriction to the drivers line of sight
    10·1 answer
  • An example of hardware is a(n) _____.
    9·2 answers
  • (a) [5 pts] Suppose you purchase a wireless router and connect it to your cable modem. Also suppose that your ISP dynamically as
    13·1 answer
  • Which of the following could you use to submit work from home?
    15·1 answer
  • Juhfvehrfwhedfhwkefhkujhiuyuiyuiyiyh
    6·1 answer
  • PLEASE HELP!!! Me turn this into a video & add liana flores- raise the moon (instrumental) in the background for the music.
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!