Based on the data definition classes identified below, assume you wish to create a Dictionary class that inherits from the Book class. In addition to title and cost, the Dictionary class must also store the number of words present in the dictionary. Write the code that will create a constructor in the dictionary class that passes in and sets the dictionary's title, cost, and number of words.

public class Book {
private String title;
private double cost;

public Book(String title) {
this(title, 0.00);
}

public Book(String title, double cost) {
this.title = title;
this.cost = cost;
}

public String getTitle() { return this.title; }
public double getCost() { return this.cost; }
}

public class Dictionary extends Book {
private double numWords;

// Create Contructor

}

Answers

Answer 1
Answer:

//==============================

// Book class

//==============================

public class Book {

private String title;

private double cost;

public Book(String title) {

 this(title, 0.00);

}

public Book(String title, double cost) {

 this.title = title;

 this.cost = cost;

}

public String getTitle() {  

 return this.title;  

}

public double getCost() {  

 return this.cost;  

}

}

//==============================

// Dictionary class

//==============================

public class Dictionary extends Book {

private double numWords;

// Create Contructor

public Dictionary(String title, double cost, double numWords){

 super(title, cost);

 this.numWords = numWords;

}

}

Explanation:

The actual response to this question is shown in bold face in the above.

Line 1:

public Dictionary(String title, double cost, double numWords){

Here the header for the constructor for the Dictionary class is written which takes in three parameters - title, cost and numWords. These parameters will be used to set the values of the instance variables of the Dictionary class.

Remember that the Dictionary class extends from the Book class. Therefore, in addition to its numWords attribute, the Dictionary class also has the title and cost attributes.

Line 2:

super(title, cost)

Here, since the Dictionary class inherits from the Book class, it can also call the constructor of Book class to initialize two of its three variables which are title and cost. Hence the need for the super() method keyword. In other words, the super() in the Dictionary class is the constructor from the parent class and it is used here to set the dictionary's title and cost attributes.

Line 3:

this.numWords = numWords;

Here, the only attribute left to be set is the numWords. Therefore, the 3rd line sets this attribute to the parameter passed into the constructor in line 1.

Line 4:

}

Here, the block containing the Dictionary class constructor is being closed.


Related Questions

what is a device driver​

Answers

Answer:

Explanation:

In computing, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer. ...

Answer:

a device driver is a computer program that operates or controls a particular type of device that is attached to a computer.[1] A driver provides a software interface to hardware devices, enabling operating systems and other computer programs to access hardware functions without needing to know precise details about the hardware being used.

Explanation:

The coding system that has just two characters is called:

a
binary
b
dual.
c
basic.
d
double.

Answers

Answer:

A. Binary

Definition:

Pertaining to a number system that has just two unique digits 0 and 1. - binary code

Answer:

a binary

Explanation:

ascii. an agreed method for paring the alpanumeric characther set with binary repersenations used in computers. binary. Pertaining to a number system that has just two unique digits 0 and 1. binary code.

Assume a file containing a series of integers is named numbers.txt and exists on the computer’s disk. Write a program that calculates the average of all the numbers stored in the file.

Answers

Answer:

Explanation:

The following code is written in Java. It assumes that the numbers.txt file is in the same folder as the Java file and the numbers are separated one on each line. It reads the file, adds all the numbers to an array, then adds the numbers into a single variable and finally divides by the total amount of numbers in order to get the average.

public static void main(String[] args) {

       ArrayList<Integer> numbers = new ArrayList();

       try {

           File myObj = new File("numbers.txt");

           Scanner myReader = new Scanner(myObj);

           while (myReader.hasNextLine()) {

               String data = myReader.nextLine();

               numbers.add(Integer.parseInt(data));

           }

           myReader.close();

       } catch (FileNotFoundException e) {

           System.out.println("An error occurred.");

           e.printStackTrace();

       }

       int average = 0;

       for (int x:numbers) {

           average += x;

       }

       average = average / numbers.size();

       System.out.println(average);

   }

Bibliography
There are some formatting errors in this bibliography
page. Which corrections should be made? Check all
that apply
O The title should be in bold.
O There should be a double space between each
citation
Amber, Claire. "How Would Gandhi Respond?"
The World Post. TheHuffington Post.com,
16 Sept. 2011. Web. 28 Feb. 2014.
Wilkinson, Philip. Gandhi: The Young Protester
Who Founded a Nation. Washington, DC:
National Geographic Society, 2005. Print.
Eknath, Easwaran. Gandhi the Man: How One
Man Changed Himself to Change the World.
Tomales, CA: Nilgiri, 2011. Print.
O The citation entries should be in alphabetical order.
The web sources should be listed first.
The second and third lines of the last entry should
be indented

Answers

Answer:

There should be a double space between each citation

The citation entries should be in alphabetical order.

The second and third lines of the last entry should be indented

Explanation:

The bibliography page contains some formatting errors which should be corrected before it is standard and acceptable.

First of all, in MLA (and most other styles), it is important to double space each citation to make them easily readable and eliminate errors.

Next, the citation entries needs to be in alphabetical order and not random which makes it easy to find a source.

Also, there needs to be indentation in the second and third lines of the last entry.

Answer:

B,C,E is the answer

Explanation:

I got it right on test...

sorry if its too late

Hope it helps someone else :D

Are dogs are dangerous. the golden retriever is a dog. there for the golden retriever is dangerous. is this argument sound or unsound?

Answers

The argument is unsound.

Write the definition of a class Phone containing: 1. A data member named model of type string. 2. A data member named partNumber of type string. 3. A data member named retailPrice of type double 4. A void method to display the fields model, partNumber, and retailPrice on the standard output.

Answers

Answer:

class Phone(object):

   def __init__(self, model, partNumber, retailPrice):

       self.model = model

       self.part_number = partNumber

       self.retail_price = retailPrice

   def phone_specs(self):

       print( "Phone model: {}\nPart number: {}\nRetail price: {}".format( self.model, self.part_number, self.retail_price))

phone1 = Phone("Nokia", "asd234", 200.0)

phone1.phone_specs()

Explanation:

A class is a blueprint of a data structure used to create objects of the same data types and methods. The Phone class is an object that creates an instance of the phone1 object. The phone_specs method is used to display the details of the phone1 object.

Which of these is an adjustment on a power rack-and-pinion steering gear?



A. Cylinder alignment
B. Sector mesh adjustment
C. cross shaft endplay
D. Pinion torque​

Answers

Answer:

a

Explanation:

Write a JavaScript script that has subprograms nested three deep and in which each nested subprogram references variables defined in all of its enclosing subprograms.

Answers

Answer and Explanation:

Subprograms are nested three deep hence we would have three subprograms/functions under one program(function)

We call the program/function MotherFunction( using camel case variable naming rules)

function MotherFunction() {

var mother= 8;

console.log(mother);

function subDaughter1() {

var subDaughter1X = mother + 12;

console.log(subDaughter1X);

function subDaughter2() {

var subDaughter2X= mother + 5;

console.log(subDaughter2X);

function subDaughter3() {

var subDaughter3X= mother + 3;

console.log(subDaughter3X);

alert("sum="+subDaughter1X+subDaughter2X+subDaughter3X);

}

}

}

}

MotherFunction();

We created the first function and nested subfunctions under it, adding up the variable from the parent function(mother function) to its subfunctions and then alerting the total value of all the subfunction variables summed in the last/third subfunction. We then called the function after defining it.

salvado has a flash disk of 1.5GB and wants to store more music files of 950KBs each . How many files will he be able to store on his flash disk?​

Answers

Answer:

Convert 1.5GB to KBs = 1500000kb

1500000kb/950kb ≈ 1579

Explanation:

A flash disk is a storage device. It has enough memory to store large files. In the given question, the flash disk has a memory of 1.5GB and can store 1578.94 music files of 950KBs each.

What is flash disk?

A flash disk is a data storage device that uses flash memory specifically : a small rectangular device which is designed to be plugged directly into a USB port on a computer. It is often used for transferring files from one computer to another computer system.

Flash disks have no mechanical platters or access arms. It is termed "disk" because of the data which are accessed as if they were on a hard drive. The disk storage structure is emulated.

In the given question, the flash disk contains 1.5GB memory and has to store music files of 950KBs each. For determining the number of music files which can be stored in the flash disks, we have to first convert the unit of flash disk from GB to KB:

1GB = 1,000,000 KB

1.5 GB = 1,500,000 KB

size of music file = 950 KB

Number of music files that can be stored = storage in the flash disk ÷ size of the music file

Number of music files = 1500000KB ÷ 950KB

Number of music files = 1578.94

Learn more about Flash disk here:

https://brainly.com/question/1130880

#SPJ2

How long will it take to transfer 1GB data on USB 2.0, on USB 3.0

Answers

Answer:

Have a great day, Here is the answer to your question:

It will take around 18 seconds

Explanation:

So in principle 1GB of data to be uploaded running at peak speed is suggested to take around 18 seconds but in fact, DCD test results show USB 2.0 takes 3 minutes 18 seconds to complete a 1GB switch. Whereas USB 3.0 can accommodate up to 5gbps of data transferred-more than 10 times faster than its predecessor.

There are thousands of downloadable digital images online that you can use in your presentations. {TRUE or FALSE}
this is for speech

Answers

True hopes this helps!

It should be noted that thousands of downloadable digital images are online for ones presentations.

This statement is true because, digital image serves as picture that is stored on a computer.

It can be been digitized, that is converted into a sequence of numbers that computers can understand and its available online.

Learn more about digital images at;

https://brainly.com/question/24448358

explain mechanical computer ,electromechanical and electronic computer with example

Answers

Answer:

A mechanical computer uses moving parts to do it’s calculations. Think old style adding machines.Electronic computers use electronic oscillators to generate a clock. The oscillator might include a mechanical element such as a crystal, but the majority of the clock signal is processed in the electrical domain.

Explanation:

An example of a mechanical computer clock is a Swiss watch movement, which needs no electronics. Movement is based upon springs coupled to other mechanical pieces. Swiss watches are high precision mechanical computers that do counting. There are other types of more sophisticated mechanical computers. Research the works of Konrad Zuse and his Z1 mechanical computer.

Select the correct answer.
Sandra has composed a draft of her essay in Microsoft Word. She now wants to revise the essay. Which tool can she use to store the document with a different name and makes changes in the new document?

A.
Share
B.
Download
C.
Make a copy
D.
Save As

Answers

Answer:

I think make a copy maybe

Explanation:

Answer:

D

Explanation:

She can save and store the doc, change the name when saving, and make changes to revise once saved.

Which Packet Tracer feature do you think will be most helpful for you in learning how to manage a network

Answers

Answer:

Its ability to sniff and analyze packets in a network.

Explanation:

Network administrators require advanced skills and tools to manage a large network, to analyze packets as they are transmitted across the network.

Packet tracer helps to monitor the network connection and packet transfer. It informs the administrator of a dropped connection, slow transmission due to a bottle-neck, and many more packet related issues

Write an application that counts the total number of spaces contained in a quote entered by the user.

Answers

Answer:

Explanation:

The following code is written in Java. It asks the user for an input and saves it in a String variable. Then it loops through all the characters in the string and counts the spaces. Finally, it prints the total number of spaces in the String.

public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter Line Now:");

       String userInput = in.nextLine();

       int spaceCount = 0;

       for (int x = 0; x < userInput.length(); x++) {

           if (userInput.charAt(x) == ' ') {

               spaceCount++;

           }

       }

       System.out.println(spaceCount);

   }

WILL BRAINLIEST Use the drop-down menu to correctly complete these sentences about the five standard Python data types.


are numeric values in Python data types.
A
is a large and changeable list that can contain any number of Python objects.

are connected sets of characters separated by quotation marks " ".

are sets of data separated by a comma between two parenthesis ( ).

are sets of data separated by a comma between two brackets [ ].

Answers

numbers,dictionary,strings,tuples and lists. in order

Answer:

numbers,dictionary,strings,tuples and lists. in order

Explanation:

list the steps to create a new folder in windows

Answers

Navigate to where you want to create the new folder, and click New Folder. Type the name of your folder, and press Enter. To save a document to the new folder, open the document, and click File > Save As, and then browse to the new folder, and click Save.

Write an expression that will print "in high school" if the value of user_grade is between 9 and 12 (inclusive).

Answers

Answer:

C#

if(user_grade >=9 && user_grade <=12)

{

   Console.WriteLine("In Highschool");

}

Python

if user_grade >= 9 & user_grade <= 12:

  print("In Highschool")

Java

if(user_grade >=9 && user_grade <=12)

{

   System.println("In Highschool");

}

Explanation:

Let f(w) = 2w^3 - 5. Let z = 2. What is f(z)?​

Answers

Answer:

Hence f(z)=11

*This is what i think*

Write a program that reads one or more strings from the standard input and outputs the count of vowels, consonants, and digit characters found in the stream.

Answers

Answer:

endinput = "no"

mylist = []

vowel = ['a', 'e', 'i', 'o', 'u']

vowelcount = 0

consonantcount = 0

digitcount = 0

string = " "

number = [ str(i) for i in range(0, 10)]

while endinput == "no":

   inputs = input("Enter string value: ")

   mylist.append(inputs)

   endinput = input("Do you want to end input? ( enter no to continue:  ")

for item in mylist:

   txt = item

   print(txt)

   for i in txt:

       if i == string:

           continue

       elif i in vowel:

           vowelcount +=1

       elif i in number:

           digitcount += 1

       else:

           consonantcount += 1  

print("Vowels: ", vowelcount)

print("Digits: ", digitcount)

print("Consonant: ", consonantcount)

Explanation:

The python program receives one or more strings from the standard input and appends it to a list. The algorithm iterates through the list of string values and counts the number of vowels, consonants, and digits.

*Python Coding
2. Driver’s License ExamThe local driver’s license office has asked you to create an application that grades the written portion of thedriver’s license exam. The exam has 20 multiple-choice questions. Hereare the correct answers:1. B 6. A 11. B 16. C2. D 7. B 12. C 17. C3. A 8. A 13. D 18. B4. A 9. C 14. A 19. D5. C 10. D 15. D 20. AYour program should store these correct answers in a list. The program should read thestudent’s answers for each of the 20 questions from a text file and store the answers inanother list. (Create your own text file to test the application.) After the student’s answershave been read from the file, the program should display a message indicating whether thestudent passed or failed the exam. (A student must correctly answer 15 of the 20 questionsto pass the exam.) It should then display the total number of correctly answered questions,the total number of incorrectly answered questions, and a list showing the question numbers of the incorrectly answered questions.

Answers

correct = (["1.B", "6.A", "11.B", "16.C","2.D", "7.B", "12.C", "17.C", "3.A", "8.A", "13.D", "18.B","4.A" ,"9.C", "14.A", "19.D","5.C", "10.D", "15.D", "20.A"])

f = open("MyFile.txt", "r")

user_answers = ([])

count = 0

txt = ""

for x in f.read():

   if x == " " or x == "\n":

       x = ""

       count += 1

   if count == 2 :

       user_answers.append(txt)

       txt = ""

       count = 0

   txt += x

i = 0

cor = 0

wrong = ([])

while i < len(correct):

   if correct[i] == user_answers[i]:

       cor += 1

   else:

       wrong.append(user_answers[i])

   i += 1

questions = ([])

for i in wrong:

   txt = ""

   for w in i:

       if w == ".":

           questions.append(int(txt))

       txt+=w

print("There were {} correct answers".format(cor))

print("There were {} incorrect answers".format(len(questions)))

print("The incorrectly answered questions are {}".format(questions))

f.close()

The file I used for testing looks like:

1. C 6. A 11. B 16. C

2. D 7. B 12. C 17. C

3. A 8. D 13. D 18. D

4. A 9. C 14. A 19. A

5. C 10. D 15. D 20. C

The code only works if there is a new line after 20. C (press enter after that question if a new line isn't already included)

I hope this helps!

Write an if-else statement for the following:
If user_tickets is less than 5, assign 1 to num_tickets. Else, assign user_tickets to num_tickets.

Answers

In python 3.8:

if user_tickets < 5:

   num_tickets = 1

else:

   num_tickets = user_tickets

For this code to work properly, you'll have to first declare user_tickets before the if-else statements.

How did DDE devices have made our daily life easier?

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

DDE (direct data entry) devices are the devices that read data from a source and transfer it directly into the computer. Unlike, other input devices which require physical interaction which requires you to move physically or to do something for an output or feeding data into a computer.  

The DDE devices require no hard work while taking input into the computer as compared to other input devices. These DDE devices made our life very easy. Because these devices take input accurately and there are no chances of human error.

The example of DDE devices are magnetic stripe reader, chip reader, Pin pads, optical mark reader, and barcode reader, etc.

These devices have brought great advantages to human life. Because by using these data entry devices, information can be put into very quickly, more accurate than typing and information of the whole page transferred .very quickly and accurately into the system. These devices are also more secure and can hold lots of data, and the data is protected with the PIN (personal identification number). These are also used in ATM machines, handheld, and entry doors.

Answer:

wait is it a write in answer or a multiple choice?

Explanation:

answer 1 question and get 10 points in return

Answers

Answer:

3

Explanation:

sorry if I'm wrong...it's been a while since I took a coding class.

3 I think... hope this helps!

Write a loop that sets newScores to oldScores shifted once left, with element 0 copied to the end. Ex: If oldScores

Answers

Answer:

Explanation:

The following is written in Java. It is a method/function that takes the oldScore as an int input. It turns it into a String, separates all the digits, puts them into an array. Then adds the first digit to the end and removes it from the beginning, thus shifting the entire score one to the left. Then it turns the String variable back into an Integer called finalScore and prints it out.

public static void newScore(int oldScore) {

       ArrayList<Integer> newScore = new ArrayList<>();

       String stringOldScore = String.valueOf(oldScore);

       for (int x = 0; x < stringOldScore.length(); x++) {

           newScore.add(Integer.parseInt(String.valueOf(stringOldScore.charAt(x))));

       }

       newScore.add(newScore.get(0));

       newScore.remove(0);

       String newScoreString = "";

       for (int x:newScore) {

           newScoreString += String.valueOf(x);

       }

       int finalScore = Integer.parseInt(newScoreString);

       System.out.println(finalScore);

   }

No variables and only in one lines

Answers

In python 3.8, we can use a simple print statement.

print(('h0 '*3 +'Merry Christmas\n')*2)

4.5 Lesson Practice edhesive

Answers

Answer:

Count Variable -- When it hits a limt.

using user input -- its true if the user input is the conditional variable needed to end it.

The two ways that one can end a loop are:

Using user input (Option B)- This is used when its true if the user input is the conditional variable  has to to terminate it;Count Variable (Option D) - When it hits a limit.

What is a loop?

In programming, the sequence of events (instruction) that continues to run repeatedly in the same chain is called a loop.

Thus, it is right to state that the two ways that one can end a loop are:

Using user input (Option B)- This is used when its true if the user input is the conditional variable  has to to terminate it;Count Variable (Option D) - When it hits a limit.

Learn more about loops at:
https://brainly.com/question/24052822
#SPJ9

typing which capitals and exclamation points in an email is an example of

Answers

it's an example of a poorly written email, it looks like somebody is angry and yelling at you, these types of emails can be described as a poor etiquette.

This is science I just couldn’t find it

Answers

Answer:

69

Explanation:

It is 69 because it is the most for that degree.

Given a binary search tree containing N integers, create an AVL tree containing the same values. You should not destroy the original BST in the process. What is the worst case time?

Answers

Answer:

answer : 0 (n log n )

Explanation:

Creating an AVL tree containing the same values and containing N integers and without destroying the original BST in the process, the worst case time will be : 0 ( n log n ) and this is because each insertion will take 0 (log n ) time

The worst case time for a binary search algorithm that contain N integers without destroying the original binary search tree (BST) is [tex]0(NlogN)[/tex]

What is a binary search?

Binary search can be defined as an efficient algorithm that is designed and developed for searching an element from a sorted list of data, especially by using the run-time complexity of [tex]0(logN)[/tex].

Note: N is the total number of elements contained in a list.

In this scenario, the worst case time for this binary search algorithm that contain N integers without destroying the original binary search tree (BST) is given by [tex]0(NlogN)[/tex]

Read more on binary search here: https://brainly.com/question/24268720

Other Questions
Click to review the online content. Then answer the question(s) below, using complete sentences. Scroll down to view additional questions. "The Pit and the Pendulum" by Edgar Allan Poe What are the three ways that the narrator`s captors attempt to kill him? What is the energy used in muscle contraction? Are the lines parallel? 2x + 3y = 6 and 2x + 3y = 10 How do you skip the drawing steps in turtle graphics and just get the result? Thank you. what is the X for this 7x+12=26 What caused Carnegie to remain in the world of business? What did not lead to industrial growth? Part 1:Manual and buck wasn't seen by anyone walking to the orchard.Buck though it was a normal stroll. They went to a place known as College Park. Manuel and the stranger talked.The stranger: You might wrap up the goods before you deliver m, he said in a deep voice Manuel:Twist it, an youll choke m plentee, Buck wore the rope with pride because he trusted Manuel to make good decisions. Buck trusted humans he knew. As soon as the stranger got handed the rope Buck started to growl and fight. But with bucks surprise the rope got tighter around bucks neck making him unable to breathe. Out of furry Buck turned around and sprang towards the stranger.Half way in the air the man caught buck by the throat and pushed buck to the ground with buck on his back. The rope got tighter.Buck : Buck though he hasn't been treated this viciously by a human his whole life. The next thing buck knew was his tongue was hunting and that he was being dragged along in some kind of carriage. There was a horrible shriek of a locomotive whistling . He had traveled too often with Judge not to know he was in a baggage car.When buck opened his eyes he realised he was kidnapped.Buck remembered the man springing to his throat but buck dogged and his jaws closed on the hand.The man said:Yep, has fits, hiding the messed hand from the man The stranger: Im takin m up for the boss to Frisco. A crack dog-doctor there thinks that he can cure m. The stranger:All I get is fifty for it, an I wouldnt do it over for a thousand, cold cash. he said grumbling and mad The stranger's hand was wrapped in a bloody handkerchief and his right pants leg was ripped in half. The salon keeper :How much did the other mug get? said in a demanding voice The stranger: A hundred. Wouldnt take a sou less, so help me. he said as a reply The salon keeper: That makes a hundred and fifty and hes worth it, or Im a squarehead. he said while looking at the stranger The kidnapper undid the bloody wrappings and looked at his lacerated hand.Stranger: If I dont get the hydrophoby he said before getting cut off Salon keeper: Itll be because you was born to hang, he laughed Salon keeper: Here, lend me a hand before you pull your freight, he added. The value of the function f(x) is 7 when x is 4 and is 13 when x is 6. The value of the function g(x) is 17 when x is 3 and is 3 when x is 5. If p represents the slope of f(x) and q represents the slope of g(x), when is the value of pq?-2/32/33/2-3/2 How did the work of the Ursulines reflect the churchs focus on community service? They helped people in need. They provided homes to clergy. They educated priests. They led Catholic Mass. when do debaters give their rebuttal arguments Help me with this please How does Priestley present selfishness and its effects in An Inspector Calls? When you are done reviewing in Print Preview, you have the option to save your document as a new file type. Which file type can be created using Print? .edu .exe .pdf .ppt In a Black Friday sale, if you buy 5 video games for $ 39.99 each, you get 1 free. After the offer, how much does each video game cost?Hint: First find the cost for the 5 video games.Write your answer in money format: round up to write 2 decimal places. Are the lines perpendicular? x = 3 and y = 5 * The weight of an object is determined by it X . ?MassGravityHeightBoth A&B Which of the following would be considered a buffalo soldier? A. a freedman serving in the US Cavalry B. a Native American serving in the Union Army C. a white settler who hunted bison for sport D. a soldier serving under George Armstrong Custer A rocket is fired in deep space, where gravity is negligible. In the first second it ejects 1/160 of its mass as exhaust gas and has an acceleration of 14.0 m/s^2.Required:What is the speed vgas of the exhaust gas relative to the rocket? I dont have anything to ask but here is 50 points