Look at the following partial class definition, and then respond to the questions that follow it:


public class Book


{


private String title;


private String author;


private String publisher;


private int copiesSold;


}


a. Write a constructor for this class. The constructor should accept an argument for each of the fields.


b. Write accessor and mutator methods for each field.


c. Draw a UML diagram for the class, including the methods you have written.

Answers

Answer 1

Solution :

a.

public Book([tex]$\text{String title}$[/tex], String author, [tex]$\text{String publisher}$[/tex], int [tex]$\text{copiesSold}$[/tex]) {

 this.[tex]$\text{title}$[/tex] = [tex]$\text{title}$[/tex];

 this.[tex]$\text{author}$[/tex] = [tex]$\text{author}$[/tex];

 this.[tex]$\text{publisher}$[/tex] = [tex]$\text{publisher}$[/tex];

 this.[tex]$\text{copiesSold}$[/tex] = [tex]$\text{copiesSold}$[/tex];

b). [tex]$\text{public String}$[/tex] getTitle() {

 return [tex]$\text{title}$[/tex];

}

[tex]$\text{public void}$[/tex] setTitle([tex]$\text{String title}$[/tex]) {

 this.[tex]$\text{title}$[/tex] = [tex]$\text{title}$[/tex];

}

[tex]$\text{public String}$[/tex] getAuthor() {

 return author;

}

[tex]$\text{public void}$[/tex] setAuthor(String author) {

 this.[tex]$\text{author}$[/tex] = [tex]$\text{author}$[/tex];

}

[tex]$\text{public String}$[/tex] getPublisher() {

 return [tex]$\text{publisher}$[/tex];

}

[tex]$\text{public void}$[/tex] setPublisher(String [tex]$\text{publisher}$[/tex]) {

 this.[tex]$\text{publisher}$[/tex] =[tex]$\text{publisher}$[/tex];

}

public int get[tex]$\text{copiesSold}$[/tex]() {

 return [tex]$\text{copiesSold}$[/tex];

}

[tex]$\text{public void}$[/tex] set[tex]$\text{copiesSold}$[/tex](int [tex]$\text{copiesSold}$[/tex]) {

 this.[tex]$\text{copiesSold}$[/tex] = [tex]$\text{copiesSold}$[/tex];

}


Related Questions

Why do people say badass

Answers

Answer:

ummm....

Explanation:

maybe they just think it sounds cool?

Badass is defined as something or someone cool or something or someone tough, rebellious or aggressive. Like for an example “yo look at my new motorcycle doesn’t it look badass (cool”

what is computer and its features

Answers

Answer:

A computer is a machine that can be programmed to manipulate symbols.

Explanation:

Following are the features of PC (computer)

Processor  

speed  

reliability  

accuracy  

automation  

diligence  

consistency    

Random access memory (RAM)  

Operating system  

Graphics adapter and video RAM  

Monitor

Answer:

Computer Is a Electronic Machine Used To Play Games and for school assigments

help please give me the correct ans....
write a qbasic program to print the word "hello" 10 times [by using for next]

Answers

http://www6.uniovi.es/qbasic/qtutor1.html

go to this link and it will show you how to solve your problem

which format is best for photos?
JPEG
DOC
GIF
Wav

Answers

JPEG from the ones you listed because it would have best quality for images and the most universal compatibility throughout devices. WAV is for audio, GIF is a small animated image which you often use on social media. DOC is for documents as the name suggests.
JPEG, it is the only image file format. DOC is for documents, GIF is for animated images (or sometimes videos without audio), and Wav is sound files.

Sanjay has 38 blue beads. And 26 red beads. He needs 8 beads to make 1 wrist band. How many wristbands can Sanjay make if he uses all of his beads?

Answers

Answer:

8

Explanation:

In total, Sanjay has 64 beads. if you divide the 64 beads by the amount of beads it takes to make one band (8) the answer would be 8.

Answer:

make the top answer brainly

Explanation:

what are the answers for these question?

Answers

Answer:

tbh u gotta give more points in order for me to solve that:)

Explanation:

Pascal system . write the program that will calculate the perimeter of a rectangle if its area is A (m²) and one of its sides has a length of B (m). A and B are entered from the keyboard.​

Answers

Answer:

The program in Pascal is as follows:

Program Perimeter;

Uses Crt;

Var

 Length : Real;

 Width : Real;

 Area    : Real;

 Perim : Real;

Begin

 Clrscr;

 Write('Area: ');

 Readln(Area);

 Write('Length : ');

 Readln(Length);

 Width := Area/Length;

 Perim := 2 * (Length + Width);

 Write('Perimeter: ' ,Perim:5:2,'.');

End.

Explanation:

This declares all variables as real

Var

 Length : Real;

 Width : Real;

 Area    : Real;

 Perim : Real;

The program execution begins here

Begin

This clears the screen

 Clrscr;

This prompts the user for Area

 Write('Area: ');

This gets input for Area

 Readln(Area);

This prompts the user for Length

 Write('Length : ');

This gets input for Length

 Readln(Length);

This calculates the width

 Width := Area/Length;

This calculates the perimeter

 Perim := 2 * (Length + Width);

This prints the calculated perimeter

 Write('Perimeter: ' ,Perim:5:2,'.');

This ends the program

End.

How do we calculate the BMI in python?
the formula is kg/m²

Answers

Answer:

height = float(input("Enter your height in m: "))

weight = float(input("Enter your weight in kg: "))

BMI = weight / (height/100)**2

print(f"You BMI is {BMI}")

Explanation:

The python code for calculating BMI is as follows -

height = float(input("Enter your height in m: "))

weight = float(input("Enter your weight in kg: "))

BMI = weight / (height/100)**2

print(f"You BMI is {BMI}")

Some conditions can also be added such as

if BMI <= 15:

   print("You are underweight.")

elif BMI <= 30:

   print("You are healthy.")

elif BMI <= 40:

   print("You are over weight.")

Edwin owns a smart phone with a digital assistant. He frequently enquires on political, sports, and weather updates. The assistant recognizes the words and phrases and provides appropriate answers. What technology is used to make the assistant respond to Edwin

Answers

Answer:

Speech synthesis

Explanation:

Synthesized speech is the technology of production of the speech of humans artificially. The technology can be made use of in hardware and software products such as a speech computer which is used to perform speech synthesis

Another implementation of the synthesized speech technology is the text-to-speech (TTS) systems that are used for the conversion of speech into written text as the words are dictated.

Select all the correct answers.

John travels all over the country visiting various clients. He needs to access his documents and services on the go. Which of these technologies
allows him to access documents and software while on the move?

A:cloud computing
B: grid computing
C:mobile computing
D:green computing
E:virtualization

Answers

Answer:

acd

Explanation:

i cant explain

Answer:

A

C

D

Explanation:

Plato

1. Which is not a cold sandwich?
a. Pinwheel sandwich
b. Tea sandwich
c. Wrap sandwich
d. Grilled sandwich

Answers

Answer:

D. Grilled sandwich

Explanation:

Grilled sandwich is a kind of hot sandwich.

edhesive assignment 2: room area?

Answers

Explanation:

a, b, c, d, e = input("A ="), input("B ="), input('C = '), input("D = "), input('E = ')

print(float(a*b + sqrt(c**2-(a/2)**2) * a/2 * 0.5))

a, b, c, d, e = input("A ="), input("B ="), input('C = '), input("D = "), input('E = ') print(float(a*b + sqrt(c**2-(a/2)**2) * a/2 * 0.5))

What is program?

The program is an illustration of functions. Functions are groups of code segments that are executed when called or evoked

The calendar program

The calendar program in Python, where comments are used to explain each line is as follows:

#This checks for leap year

def leap_year(y):

if y % 4 == 0:

return 1 else return 0

#This returns the number of days in the month

def number_of_days(m,y):

if m == 2:

return 28 + leap_year(y)

elif m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m ==10 or m == 12:

return 31

elif m == 4 or m == 6 or m == 9 or m == 11:

return 30

#This returns the number of days left in the month

def days(m,d):

dayList = [0,31,59,90,120,151,181,212,243,273,304,334]

return dayList[m-1] + d

#This returns the number of days left in the year

def days_left(d,m,y):

if days(m,d) <= 60:

return 365 - days(m,d) + leap_year(y) else:

return 365 - days(m,d)

#The main begins here

#This next three lines gets input for date

day=int(input("Day: "))

month=int(input("Month: "))

year=int(input("Year: "))

#This gets the choice from the user

menu=int(input("Press 1 to calculate the number of days in the given month.\nPress 2 to calculate the number of days left in the given year.\nChoice: "))

#This prints the number of days in the month

if menu == 1:

print(number_of_days(month, year))

#This prints the number of days left in the year

elif menu == 2:

print(days_left(day,month,year))

Read more about Python functions at:

brainly.com/question/14284563

#SPJ7

The complete part of the question will be:

Assignment 3: Chatbot

What the code for assignment 3: chatbot Edhesive.

(25 POINTS)Which statement best reflects the importance of following safety guidelines?

Workplace injuries can result in losses to an organization’s profits.

OSHA responds to complaints of unsafe work environments, and can fine or take negligent employers to court.

Every year, thousands of people die as a result of workplace injuries.

Using equipment safely is faster and makes work more efficient.

Answers

Answer:

I think, Every year, thousands of people die as a result of workplace injuries.

Answer:

B

Explanation:

product of -6/13 and reciprocal of -7/16 is ____________​

Answers

Answer:

-250/91

Explanation:

Use a calculator

Que es hipermedia


porfavorrrrr

Answers

Explanation:

hipermedia sirve para designar al conjunto de métodos o procedimientos para escribir, diseñar o componer contenidos que integren soportes tales como: texto, imagen, video, audio, mapas y otros soportes de información emergentes, de tal modo que el resultado obtenido, además, tenga la posibilidad de ...

Help! ASAP! 1 Question.........°○°​

Answers

Answer: I think D)?

Explanation: Or B)

Francesca wants to create a program that will produce the phrase “Hello, world” on the screen. Which of these functions should Francesca use?

Answers

Answer:

It would be print.

Explanation:

If you want to execute a function it should be print so it will show up in the output box.

Question 6 [10 marks] a) How does a company's use of information systems affect its corporate strategies? (7 marks) b) Provide an example. (3 marks)

Answers

Answer:

following are the responses to the given question.

Explanation:

The capability to successfully utilize IT is mutually dependent on its ability to execute strategic strategy and set business goals. The ability to compete more and more relies on the capacity of an organization of using technology. In the future, what a company wants to do will rely on what its technologies can do. It may be an example of a company investing in information technology that allows a company to manufacture new products or improve the efficiency of the distribution system to the corporation's economic efficiency.

In what way do graphs and charts help in decision-making? Select the most important point.

A.
They identify errors in the data.
B.
They can be included in slideshow presentations.
C.
They reveal patterns in data.
D.
They automate calculations.
E.
They can be inserted into documents.

Answers

I think c. They reveal patterns in data.

Match each of the following network types to its definition: I. HAN II. MAN III. LAN IV. PAN V. WAN A. confined to a small geographic location beyond the home B. services a residence C. used to communicate among devices near an individual D. covers a city E. a network that covers the greatest distance

Answers

Answer:

I. ===> B

II. ===> D.

III ===> A

IV ===>  C

V ===> E.

Explanation:

PAN is the smallest network. Then comes then HAN then LAN.

MAN covers a city and WAN covers the greatest distance.

Los organos de los sentidos perciben de la misma manera un estimulo?porque?

Answers

Espero que te ayude!!!!

Why are message board discussions moderated?

A.
to rectify spelling and grammar
B.
to delete irrelevant or offensive posts
C.
to facilitate communication between group members
D.
to ensure that discussions topics are interesting

Answers

A ibahg ninja idea a,c

explain what the hexadecimal code in a MAC address represents

Answers

Answer:

An Ethernet MAC address consists of a 48-bit binary value. Hexadecimal is used to identify an Ethernet address because a single hexadecimal digit represents 4 binary bits. Therefore, a 48-bit Ethernet MAC address can be expressed using only 12 hexadecimal values.

Pleaseeee hellppp!!!!!

Answers

Answer:

credit card info and delivery address

Explanation:

Debug the following program.


REM "Program to generate 2 2 4 6 10. 16... up to 10th terms" CLS

A=2

B=3

For I=1 to 10

Display A; B;

A=A+B

B=A+B

NEXT X

END​

Answers

Answer:

The debugged program is as follows:

A=2

B=2

For I=1 to 10

PRINT A

TEMP = A

A=B

B=TEMP+A

NEXT I

END

Explanation:

First, the value of B should be changed to 4 (because the second term of the sequence is 2

Next, change Display to Print because Q-basic uses the print keyword to display output

The sequence is not properly generated. So, I update that part of the program to:

For I=1 to 10

PRINT A

TEMP = A

A=B

B=TEMP+A

NEXT I

Lastly, the loop is controlled by variable I (not X).

So change NEXT X to NEXT I

Andy is working on a project to build an accounting software program for his firm. He uses old programming modules that contained code to perform various processes and links them to create a complete system. Which approach does he apply to the program design?
A.
structured programming
B.
non-structured programming
C.
top-down approach
D.
bottom-up approach
E.
modular programming

Answers

Answer:

E.  modular programming

Explanation:

Andy is applying a design known as modular programming. This is basically a design in which the entire project is broken down into various parts known as modules. Each one of these modules performs a very different and unique task. As the modules are created they are linked together like pieces of a puzzle in order to form the entire project. This makes tackling a large project much easier and makes debugging problems much easier as well.

Which statement best describes a database?

Select one:
a. A collection of related tables.
b. Tables that are in sequence.
c. Tables of related information.
d. A collection of tables.

Answers

I think it's a. A collection of related tables

Need answer ASAP!!!!

Answers

Hi,

I tried answering this. Lol. Look at the image.

You are designing an ecommerce web application that will scale to hundreds of thousands of concurrent users. Which database technology is best suited to hold the session state in this example

Answers

Answer: Amazon DynamoDB

Explanation:

The database technology that is best suited to hold the session state in this example is the Amazon DynamoDB.

Amazon DynamoDB is a document database which helps in delivering high quality and fast cperformance at any scale. It can be used to scale to hundreds of thousands of concurrent users as it's multi-active, and has a durable database that has built-in security.

any part of a computer which you are able to touch is called​

Answers

You can touch the key board and screen at any time
The Physical Part of the Computer That You Can See and Touch Are Called Hardware
Other Questions
'To help built a playground, people could buy a brick with their name on it for $96. A total of $9,602 was raised, but 25 people donated an extra $50 each. How many people donated only $96?" faktor sepunya terbesar bagi 24,36 dan 72 pls help me need help fast what is uniform motion ? the ratio of men to women working for a company is 4 to 7 if there are 231 employees total how many women work for the company. ?2Find the arc length of the partial circle.Either enter an exact answer in terms of it or use 3.14 for it and enter your answer Why was Florence, Geona, and Venice important? Please help!!! I am stressed so much!! Help ASAP thank you! !HELP ASAP / GEOMETRY15 POINTSwhat is the side length? These people were accepted in the Abbasid Empire: MULTIPLE CHOICE 1. Muslims2. Christians3. Jews4. All of the above Lana needs to find the. to find this, she could list. of both numbers, and circle each bumber that appeas in both lists. she should then identifiy the. number circled in both list Greatest common factorLeast common factorFactors MultiplesLeastGreatest242448 "I've been absolutely terrified every moment of my life - and ive never let it keep me from doing a single thing I wanted to do ."- Georgia OKeeffewhats her message? answer if you know pls The Pyramid arena is 321 feet tall and has a square base of sides 591 feet. Find the volume of pyramid. A team of five people is formed from 8boys and 5 girls.the probability that the team contains at least 3girls is? What was AZTECS governmental structure?Report if wrong, BRAINLIST if correct ILL GIVE BRAINLIEST!! Which statement best identifies the central idea of the text?A.Few prisoners were subjected to death marches, as Allied troops were able tointervene during the evacuations.B.Toward the end of the war, some concentration camp prisoners were able toescape the SS during evacuations.C.The frequent transportation of concentration camp prisoners was done toconfuse and discourage Allied forces.D. Evacuations of concentration camps became known as death marches that leto the brutal deaths of thousands of people. What are the three kinds of climate data that scientists can measure directly? The inverse of y = e^x