Janitor and Cashier classes have a print function that is similar. How can we refactor this code to reduce repetition?

Answers

Answer 1

A sample code to show how to refactor a code to reduce repetition if two classes have a print function that is similar:

The Code

public abstract class DeviceMessageBase

{

   public void Connect()

   {

      // do connect things

   }

   public void WaitMessage()

   {

       // do wait message things

   }

   public void ParseMessage()

   {

       // do parse message things

   }

   public abstract void ProcessMessage();

}

public class DeviceMessageNavigator : DeviceMessageBase

{

   public override void ProcessMessage()

   {

       //**//NAVIGATE MESSAGE(Pass it to somewhere else)**

   }

}

public class DeviceMessagePrinter : DeviceMessageBase

{

   public override void ProcessMessage()

   {

       //**//PRINT MESSAGE**

   }

}

Read more about programming here:

https://brainly.com/question/23275071

#SPJ1


Related Questions

Imani needs to copy text from one document into another document. She needs the pasted text to retain its original appearance. When she pastes the text, she should use which of the following settings?

Keep Text Only

Use Destination Theme

Merge Formatting

Keep Source Formatting

Answers

Answer:

Keep Text Only

Explanation:

Because why would it be any of the other ones so it would be that

Imani must transfer text from one paper to another. She ought to preserve the formatting from the original content when she pastes it. Hence, option D is correct.

What is a Document?

A file produced by a software program is a computer document. Originally used to describe only word processing documents, the term "document" is now used to describe all saved files. Text, photos, music, video, and other sorts of data can all be found in documents.

An icon and a filename are used to identify documents. The filename gives the file a specific name, whereas the icon depicts the file type visually. The majority of filenames for documents also contain a file extension, which indicates the file type of the document. For instance, a Photoshop document might have a.PSD file extension, whereas a Microsoft Word document would have a.DOCX file extension.

To get more information about Document :

https://brainly.com/question/2901657

#SPJ6

why information systems were centralized and used solely with governance and management
during the First Era

Answers

The data will be given according to the supply and the processor was strong with governance and management

What is information systems?

Storage of data sets, interaction logs, documents, and modification histories can be done with the help of computer systems. The organization will spend a considerable amount of time hunting for certain data if the conventional remote backup is used.

Strategic planning is a governance strategy used by governments. The act of submitting, succumbing, or providing details is known as data compliance was used in the First Era.

Learn more about information systems, here:

https://brainly.com/question/13299592

#SPJ1

Taking on a programming internship does not provide training and is of little value to an intern. True or False.

Answers

Answer:

the correct answer is False

The student's quiz grades are stored in the Python list quizzes. To calculate the student's quiz average we need to drop the 3 lowest scores and calculate the average of the remaining quizzes. The output is to be the average of the remaining quiz grades and the quiz grades that were dropped. Make use of the string formatting in section 3.7 to create the output.

Answers

The program that will compute the average quiz grade for 5 students is given below:

The Program

# This program will compute the average quiz grade for 5 students

print("Hello, this program is designed to compute the average quiz grades for the following students: Clark, Nicole, Kiran, Alex, and Erik")

students = ["Clark", "Nicole", "Kiran", "Alex", "Erik"]

grades = []  # create an empty list to store the grades in

for student in students:

   print(student, ", What was your quiz grade?")

   grade = input("My grade is: ")

   grades.append(int(grade))  # convert the grade to an integer number, then add it to the list

print("Here are the grades you entered: ", grades)

average = sum(grades) / len(grades)

print("The average is:", average)

highest = max(grades)

print("The highest grade is:", highest)

Read more about programming here:

https://brainly.com/question/23275071

#SPJ1

Write a program that takes in three integers and outputs the median value (not the largest or smallest value). End the output with a newline. Ex: If the input is: 7 1 4 the output is: 4
in C++ please

Answers

Hope this helps bro

HELP PLEASE
Which type of error occurred in the following lines of code?

>>> print(9 / 0)
Traceback (most recent call last):
File " ", line 1, in
9/0
ZeroDivisionError: division by zero

logical error
logical error

exception
exception

syntax error
syntax error

reserved word error
reserved word error

Answers

Answer:

Logical Error

Explanation:

The division by 0 is a logical error.

write a complete main that will input a decimal number, double it and display the results

Answers

Answer:

No sure what language you want but since I am best with Java.

class Main {

 public static void main(String[] args) {

   Scanner input = new Scanner(System.in);  // Create a Scanner object

   System.out.println("Enter Number");

double number01 = input.nextLine();  // Read user input

double multi = number01 * 2;

   System.out.println("Number is " + multi);  // Output user input

}

}

Explanation:

I want to know if C# can be used to solve questions here as well.

Answers

What exactly is the question that you’re asking what is C #?

The Window logo at the top left hand side of the page is known as​

Answers

Answer:

The title bar is a horizontal bar located at the top of a window in a GUI. It displays the title of the software, name of the current document or file, or other text identifying the contents of that window.

Explanation:

SOMEONE PLEASEE *URGENT**

Sequencing and Flowcharting
Try writing out the sequence of events for one of the simple instructive processes below:

1. Drawing a square on a piece of 8 x 11 paper.
2. Moving from your 2nd-period class to your 3rd-period class.
3. Adding a new contact to your list of cell phone contacts.

Now, create a flowchart that outlines how to complete your chosen sequence of events. You may wish to reference these common flowchart symbols as you work.

Submit
1) In the text box: Your sequence of events written out.

2) A file image of your flowchart outlining that sequence of events.

Answers

hope this helps!!!!!

1. What is the difference between tools and equipment?

2. Describe the word paraphernalia.​

Answers

Answer:

down below

Explanation:

1- tools can be any item used to achieve a goal. an equipment is a specific tool used to achieve a specific object

2- it means article of equipment. equipment used for a particular activity.

hope this helps<3

Tools are used to fix things or help fix things and equipment is like for example I need equipment for my in home gym

What is the missing line of code?
class vehicle:
self.model = strModel
self.color = strColor
def
_str_(self):
return self.model +
+ self.color

Answers

Answer:

def__init__(self,strModel,strColor):

What does the office background allow you to do?

Answers

Answer: Any changes that you make to the Office Background in PowerPoint 365 will be reflected in all other Microsoft Office 365 products on your computer, such as Word, Excel, Outlook, and others. These patterned strips are not activated by default.

Your team has been assigned responsibility to identify an appropriate MSSP provider for a small, rural hospital. What criteria will you use to select an appropriate provider? Do research online to identify three MSSP providers. Use the criteria you established to rate each of the three, and choose the one that would be best for the hospital.

Answers

The Criteria for Choosing the Right MSSP for for a small, rural hospital are:

Customized solution. UX – User experience. Responsiveness. Cost-effective.

What are the three MSSP providers?

They are:

1) Cipher.

2) SecurityHQ.

3) SecureWorks.

The option that is chosen among the three is Cipher. It is known to be chosen because they provide the services listed above which is needed by the hospital as well as:

Cybersecurity MonitoringIncident Management and Cyber Defense Security Asset Management, etc.

Therefore, based on the above. The Criteria for Choosing the Right MSSP for for a small, rural hospital are:

Customized solution. UX – User experience. Responsiveness. Cost-effective.

Learn more about Cipher from

https://brainly.com/question/14754515
#SPJ1

Computer applications can help us to stay organized, but they can also add a lot of complexity! What are some ways you use applications to help streamline your life? What else would you like to use to further improve your organization?

Answers

The ways that a person can use applications to help streamline your life are:

It helps a person to delegate one task.It helps to De-clutter a person's workspace.It helps to make a system for a regular task. It helps to break as well as cut down one's communicationIt helps to plan out your week.

What else would you like to use to further improve your organization?Application's that can give constructive feedback. ...Applications that helps to Organize and optimize tasks. .

What is the meaning of computer application?

Computer Application is known to be a term that connote a kind of an identifiable computer software process that is often used to make as well as gets back  communications or transactions on a person's behalf or on behalf of an organization which it stands for.

Therefore, The ways that a person can use applications to help streamline your life are:

It helps a person to delegate one task.It helps to De-clutter a person's workspace.It helps to make a system for a regular task. It helps to break as well as cut down one's communicationIt helps to plan out your week.

Learn more about Computer applications from

https://brainly.com/question/24264599

#SPJ1

Rank the following storage systems from slowest to fastest:
a. Hard-disk drives
b. Registers
c. Optical disk
d. Main memory
e. Nonvolatile memory
f. Magnetic tapes
g. Cache

Answers

Answer:

Slower = Larger capacity (and vice versa)

Ranked from Slowest to Fastest:

1. magnetic tapes

2. optical disk

3. hard-disk drives

4. nonvolatile memory

5. main memory

6. cache

7. registers

Bad Directions You are driving to your friend’s house and are using your smartphone for directions. While approaching your destination, you realize that your smartphone app instructed you to turn the wrong way on your friend’s street. How could this have happened?

Answers

This could have happened when:

Lack of Internet service or failureWrong application.What do you mean by Internet?

The Internet is seen as a form of a network that helps people to  connects their computers all over the nation.

In this age,  Through the help of the Internet, people are able to  share information and navigate through places.

Note that the problem of bad direction could have happened when:

Lack of Internet service or failureWrong application.

Learn more about Internet from

https://brainly.com/question/2780939

#SPJ1

Do some research and find out whether Babbage’s Analytical Engine is a computer according to the von Neumann model.

Answers

Answer: The Analytical Engine incorporated an arithmetic logic unit, control flow in the form of conditional branching and loops, and integrated memory, making it the first design for a general-purpose computer that could be described in modern terms as Turing-complete.

Write code to print values of integers x, y, and z in a single line such that each value is left-justified in 6 columns

Answers

The code to print given value can be x = int(input ("enter first number: ")) y = int(input ("enter second number: ")) z = int(input ("enter third number: ")) print('%6d %6d %6d' %(x,y,z)).

What is a code?

Print is a function in many programming languages that sends text, variables, or another object to the screen. If you're more familiar with the Scratch programming language, print is equivalent to say.

The print command is used to print a file without using a printing-capable Windows application.

We receive three integer variables (x,y,z) using the Python programming language, and the values are printed out using string formatting (%6), which specifies that the output should be right justified with a width of 6.

x = int(input ("enter first number: "))

y = int(input ("enter second number: "))

z = int(input ("enter third number: "))

print('%6d%6d%6d'%(x,y,z)).

Thus, this is the code to print given value.

For more details regarding a code, visit:

https://brainly.com/question/1603398

#SPJ1

A computer is experiencing network connectivity issues; what step would you NOT attempt to solve the problem?

Answers

Answer:

A step I wouldn't take is throwing the computer in the trash and lighting my house on fire.

Explanation:

Environment varies firm to firm
of
Select one:
O True
tion
False

Answers

Answer:

true

...................

________________ is one example of a career that is available within the web and digital communications path.

Question 13 options:

Multimedia artists and animators


Engineer


Police Officer


Programmer

Answers

Answer:

multimedia artists and animators

Which of the following information
is required by application programs
to access the content ofa file.
a. File name
b. File location
c. File extension
d. File size

Answers

An information which is required by application programs to access the content of a file is: c. File extension.

What is a file?

A file can be defined as a computer resource or type of document that avails an end user the ability to save or record data as a single unit on a computer storage device.

In Computer technology, a sequence which best reflects the size of various files and their extension on a computer system, from smallest to largest include the following:

Text (.txt)Compressed files (.zip)Picture (.jpeg)Audio (.mp3)Video (.mp4)

In conclusion, we can reasonably infer and logically deduce that an information which is required by application programs to access the content of a file is file extension because an error would occur if there's an incompatibility issue between the two resource.

Read more on file extensions here: brainly.com/question/1982059

#SPJ1


Imagine that you are designing a smishing scam that involves sending text to people to entice them to go to a website and provide personal information that
you can use to access their checking account.
Open a new Microsoft® Word document and craft a text message that would be difficult for people to ignore.
Design a simple web page that would look legitimate to people who bank at your bank and that would capture their checking account number and PIN.

Answers

Answer:

Explanation:

i attached picture down check it below

You want to see data on charters flown by either Robert Williams (employee number 105) or Elizabeth Travis (employee number 109) as pilot or copilot, but not charters flown by both of them. Create the table that would result from applying the SELECT and PROJECT relational operators to the CHARTER table to return only the CHAR_TRIP, CHAR_PILOT, and CHAR_COPILOT attributes for charters flown by either employee 105 or employee 109.

Answers

Answer:

So, what is the question?!

Explanation:

HOW TO WRITE IN MACHINE STENO?



1.we have a meeting in our office during the afternoon.
2.inbetween of the left and rightwe have the vowel.
3.The left side of the keyword is didecated to the beginning of the syllable.

Answers

Answer:

so first download the app if u have a mac it's easy

Explanation:

app name I guess you know so u can easily find and get it

Carlos is having trouble with his device. It keeps freezing on him and he does not know what to do. What is the first step he should take when troubleshooting this problem?

A.
sell the computer

B.
check for power issues

C.
restart his device

D.
verify network connectivity

Answers

c restart his device

Explanation:

it is freezing and the most logical reason is c restart his device

> var direction = []; directions.push("walk to corner");//1 directions.push("turn right");//2 directions.push("walk one block");//3 directions.push("turn left");//4 directions.push("walk to gray house");//5 directions.push("go down the strairs");//6 directions.push("knock on the pink door");//7 console.log(directions); "knock on the pink (7) ["walk to corner", "turn right", "walk one block", "turn left", "walk to the gray house", "go down the astairs" door",]

is dis code correct​

Answers

Answer:

no it's not correct.........

Which of the following is NOT an e-reader you would use as an alternative to carrying around a set of textbooks?

Answers

Answer:

Which of the following is NOT a benefit of a word processing application?

Explanation:

Name this program lower.c - This program will read two strings and output which string has more lowercase letters. If both strings contain the same amount of lowercase letters, indicate the number of lowercase letters. Match the output according to the examples below. Assume each string will contain less than 50 characters.

Examples
Enter two strings:
Hello wORLD
'Hello' contains 3 more lowercase letter(s) than 'wORLD'.

Enter two strings:
HELLO WORLD
'HELLO' and 'WORLD' both contain 0 lowercase letter(s).

Enter two strings:
CRIMson! tide1
'tide1' contains 1 more lowercase letter(s) than 'CRIMson!'.

Answers

The program will be:

#include <stdio.h>

int lower_count(char s[]) {

   int count = 0, i;

   for (i = 0; s[i]; i++) {

       if (s[i] >= 'a' && s[i] <= 'z')

           ++count;

   }

   return count;

}

int main() {

   char str1[51], str2[51];

   int count1, count2;

   printf("Enter two strings:\n");

   scanf("%s", str1);

   scanf("%s", str2);

   count1 = lower_count(str1);

   count2 = lower_count(str2);

   if (count1 > count2) {

       printf("'%s' contains %d more lowercase letter(s) than '%s'.\n", str1, count1 - count2, str2);

   } else if (count1 < count2) {

       printf("'%s' contains %d more lowercase letter(s) than '%s'.\n", str2, count2 - count1, str1);

   } else {

       printf("'%s' and '%s' both contain %d lowercase letter(s).\n", str1, str2, count1);

   }

   return 0;

}

What is a program?

It should be noted that a series of instructions written in a programming language for a computer to follow is referred to as a computer program.

The software, which also contains documentation and other intangible components, comprises computer programs as one of its components. Source code is a computer program's human-readable form.

In this case, the program is shown above.

Learn more about program on:

https://brainly.com/question/26642771

#SPJ1

Other Questions
what is going to be the shortest, most concise restatement of information? the original source of information the original source of information a sum give me 4 characteristics of a good map highlight the steps you will take to draw the map of your school compound What was the prevailing attitude of muslim leaders toward science during the golden age? hostility as science was viewed as a threat to faith deep respect as understanding nature was viewed as an act of worship mockery because science seemed inconsistent and less compelling than the quran indifference due to the richness of the faiths insights A charge of 10 coulomb passes through a cross-section of a conductor in 20 seconds. What is the magnitude of current flowing through it? may you pls help me i do not know how to do it Question 3 of 19The word love is a(n).A. adverbB. concrete nounO C. possessive nounOD. abstract nounSU richard h. steckel, "health and nutrition in pre-columbian america: the skeletal evidence," journal of interdisciplinary history 36, no. 1 (summer 2005): 1921. Given: 0= 51opposite = 15Find: sin 0 = hepatic steatosis in diabetic patients does not predict adverse liver-related or cardiovascular outcomes Can you solve?John is told to find 3 specific marbles within a box of 60 marbles. The room is dark and he cant see the marbles properly. He pours out 20 of these marbles, and blindly chooses 3 of them. What are the chances he chooses the 3 specific marbles he was told to find?Please look at the link of someone getting answered a similar question: https://brainly.com/question/14352170 The white whale swam before him as the monomaniac incarnation of all those malicious agencies which some deep men feel eating in them, till they are left living on with half a heart and half a lung. what theme of the novel does this excerpt best address? natures indifference to man mans indifference to nature the self-destructive nature of obsession the personal empowerment that comes from obsession money marilyn is going on a class outing to an amusement park. she has $40 to spend. the admission price is $20. she plans to buy a sandwich for $5. a cup of lemonade costs $3.00. write an inequality to show how many cups of lemonade, c, she can buy. The rhombus shown below has been dissected into smaller rhombuses andequilateral triangles whose side lengths are all unequal positive integers.Find the smallest possible perimeter of the rhombus. Which action best completes the diagram showing how the federal budget iscreated??The president submits a budget plan to Congress.Congress debates and finalizes the budget.Congress returns the budget to the president.The president signs the spending bill into law.A. The president reviews the budget with the Supreme Court.OB. Congress votes on requirements for a budget plan.C. State governments submit their budget proposals.OD. Executive agencies submit budget requests. The structure labeled as x is the___, so the cell in the image is a ____. The structure labeled as w is the ___, so the cell in the image is a ___ What is the difference between single point and multiple point perspective write as a power of a primea) 64b) 169c) 625 Can someone please help me with this problem? 6 = |x| - 2 In a group of five people, two report annual incomes of $25,000 and the other three report incomes of $34,000, $46,000, and $105,000, respectively. The mode of this group's distribution of incomes is _____ Object a has a density of 10g/cm^3 and a mass of 9. object b has a density of 10g/cm^3 and a mass of 4g. which object has a greater volume and by how much?