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
Delvig [45]
3 years ago
10

Using the given definition of the Measurable interface: public interface Measurable { double getMeasure(); } Consider the follow

ing code snippet, assuming that BankAccount has a getBalance method and implements the Measurable interface by providing an implementation for the getMeasure method: Measurable m = new BankAccount(); System.out.println(_________________________); Select the correct expression to display the balance of the bank account.
Computers and Technology
1 answer:
lara31 [8.8K]3 years ago
5 0

Answer:

((BankAccount) m).getBalance()

Explanation:

m.getBalance look like the most appropriate answer but if we take a look at the Measurable interface, we realized that getMeasure doesn't return a String. So, in other to avoid runtime exception, we try to cast the return type to object of BankAccount type.

The code snippet would be;

Measurable m = new BankAccount();

System.out.println(((BankAccount) m).getBalance());

You might be interested in
Y'+2y = 5-e^(-4x), y(0)=-11
Anastaziya [24]

Answer:

  see attached

Explanation:

A differential equation solver says the exact solution is ...

  y = 5/2 -14e^(-2x) +1/2e^(-4x)

The y-values computed by Euler's method will be ...

  y = ∆x·y' = 0.1(5 - e^(-4x) -2y)

The attached table performs these computations and compares the result. The "difference" is the approximate value minus the exact value. (When the step size is decreased by a factor of 10, the difference over the same interval is decreased by about that same factor.)

4 0
3 years ago
Assign testResult with 1 if either geneticMarkerA is 1 or geneticMarkerB is 1. If geneticMarkerA and geneticMarkerB are both 1,
OverLord2011 [107]

Answer:

Following python statement will give the assignment to testResult as specified:

if((geneticMarkerA == 1) or (geneticMarkerB ==1)):

   testResult = 1

if((geneticMarkerA ==1) and (geneticMarkerB == 1)):

   testResult = 0

if((geneticMarkerA == 0) and (geneticMarkerB == 0)):

   testResult = 0

Explanation:

In above statements or and and operator are used to check the conditions of set of values present in variable geneticMarkerA and geneticMarkerB.

Based on if the condition evaluate to true or false respective values to testResult varaible is assigned.

Following is sample run for above statements:

geneticMarkerA = 1

geneticMarkerB = 0

if((geneticMarkerA == 1) or (geneticMarkerB ==1)):

   testResult = 1

if((geneticMarkerA ==1) and (geneticMarkerB == 1)):

   testResult = 0

if((geneticMarkerA == 0) and (geneticMarkerB == 0)):

   testResult = 0

print(testResult)

Output

1

4 0
3 years ago
A security operation center (SOC) analyst investigates the propagation of a memory-resident virus across the network and notices
masya89 [10]

A type of virus that influences this circumstance in the network bandwidth is a worm.

<h3>What is Virus in technology?</h3>

In computers and technology, viruses may be characterized as a sort of malicious software, or malware, that extends between computers and provokes a deterioration of data and software either partially or completely.

The complete question is as follows:

  • A micro virus
  • a multipartite virus
  • A worm
  • a program virus.

Worms are memory-resident viruses that duplicate over the network resources. The primary consequence of this type of virus is to rapidly eradicate network bandwidth with its duplication.

This virus may also be competent to accomplish a Denial of services invasion by slamming O.S and servers.

Therefore, the correct option for this question is C, i.e. a worm.

To learn more about Computer viruses, refer to the link:

brainly.com/question/26128220

#SPJ1

5 0
2 years ago
Write a function wordcount() that takes the name of a text file as input and prints the number of occurrences of every word in t
o-na [289]

Answer:

I am writing a Python program. Let me know if you want the program in some other programming language.        

import string  #to use string related functions

def wordcount(filename):  # function that takes a text file name as parameter and returns the number of occurrences of every word in file

   file = open(filename, "r")  # open the file in read mode

   wc = dict()  # creates a dictionary

   for sentence in file:  # loop through each line of the file

       sentence = sentence.strip()  #returns the text, removing empty spaces

       sentence=sentence.lower() #converts each line to lowercase to avoid case sensitivity

       sentence = sentence.translate(sentence.maketrans("", "", string.punctuation))  #removes punctuation from every line of the text file

       words = sentence.split(" ")  # split the lines into a list of words

       for word in words:  #loops through each word of the file

           if len(word)>2:  #checks if the length of the word is greater than 2

               if word in wc:  # if the word is already in dictionary

                   wc[word] = wc[word] + 1  #if the word is already present in dict wc then add 1 to the count of that word

               else:  #if the word is not already present

                   wc[word] = 1  # word is added to the wc dict and assign 1 to the count of that word                

   for w in list(wc.keys()):  #prints the list of words and their number of occurrences

       print(w, wc[w])  #prints word: occurrences in key:value format of dict        

wordcount("file.txt") #calls wordcount method and passes name of the file to that method

Explanation:

The program has a function wordcount that takes the name of a text file (filename) as parameter.

open() method is used to open the file in read mode. "r" represents the mode and it means read mode. Then a dictionary is created and named as wc. The first for loop, iterates through each line (sentence) of the text file. strip() method is used to remove extra empty spaces or new line character from each sentence of the file, then each sentence is converted to lower case using lower() method to avoid case sensitivity. Now the words "hello" and "Hello" are treated as the same word.

sentence = sentence.translate(sentence.maketrans("", "", string.punctuation))  statement uses two methods i.e. maketrans() and translate(). maketrans() specifies the punctuation characters that are to be deleted from the sentences and returns a translation table. translate() method uses the table that maketrans() returns in order to replace a character to its mapped character and returns the lines of text file after performing these translations.

Next the split() method is used to break these sentences into a list of words. Second for loop iterates through each word of the text file. As its given to ignore words of length 2 or less, so an IF statement is used to check if the length of word is greater than 2. If this statement evaluates to true then next statement: if word in wc:   is executed which checks if the word is already present in dictionary. If this statement evaluates to true then 1 is added to the count of that word. If the word is not already present  then the word is added to the wc dictionary and 1 s assigned to the count of that word.

Next the words along with their occurrences is printed. The program and its output are attached as screenshot. Since the frankenstein.txt' is not provided so I am using my own text file.

4 0
3 years ago
What is the purpose of the Excel Function Reference?
Citrus2011 [14]

Answer:

To look up functions and their purposes

Explanation:

Edg

3 0
3 years ago
Other questions:
  • Some cases have ____, also called spacers, which are round plastic or metal pegs that separate the motherboard from the case, so
    9·1 answer
  • Is it possible to uninstall a program that's on your phone from computer?
    8·1 answer
  • Multiple Choice
    6·1 answer
  • One common method of converting symbols into binary digits for computer processing is called ASCII​ (American Standard Code of I
    5·1 answer
  • )finding an unused location in the hash table is called
    5·1 answer
  • Which of the following is an example of a long-term goal?Developing a lifetime savings plan
    11·1 answer
  • What is Celeste? ( This is for my coding class )
    6·2 answers
  • If cell G7 contains the function ________, it states that if the value in cell C3 is 9, the number 7 will be assigned to cell G7
    6·1 answer
  • Pleasee helpppppppppppppppppppppp me!
    7·1 answer
  • Information to develop a project network is collected from the.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!