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
bearhunter [10]
3 years ago
15

Where might the Null Object pattern be useful?

Computers and Technology
1 answer:
Tanzania [10]3 years ago
5 0

Answer:  Null Object pattern be useful when the absence of an object can be encapsulated by other alternatives which does not have any have any effect.

Explanation:

public interface Rectangle {

double area();

   double surfaceare();

   boolean isNull();

}

In the code above we have a function for null object. So in the absence of an object we have encapsulated with a method of null which does not do anything. It simplifies the use of dependencies that can be undefined.

In case of collaborator the NULL object pattern makes use of the existing collaboration instead of defining a new one.

It also enable to abstract the handling of null objects from the client so that internal details of the program are not know to outsiders.

You might be interested in
Assuming that all of the table and column names are spelled correctly, what's wrong with the INSERT statement that follows?
Whitepunk [10]

Answer:

C. The number of items in the column list doesn't match the number in the VALUES list.

Explanation:

The INSERT INTO statement is used to insert new records in a table.

<u>Syntax is as follows:</u>

INSERT INTO table_name (column1, column2, column3, ...)

VALUES (value1, value2, value3, ...);

Each column item has to match with the values to be inserted in the same order.

In the question, there are 8 column items specified whereas there are only 7 values given to be inserted.

3 0
3 years ago
Which item converts a high level language program to low level machine instruction?
vodomira [7]
The compiler translates each source code instruction into the appropriate machine language instruction, an
8 0
3 years ago
How many pins are typical molex connector?
kondor19780726 [428]
There are 4 connectors, from left to right the pins are +5v ground ground +12v
5 0
3 years ago
Write a program that reads a string consisting of a positive integer or a positive decimal number and converts the number to the
jeka94

Answer:

#include <iostream>

#include <string>

#include <stack>

#include <math.h>

using namespace std;

int main() {

  string s;

  double n=0;

  int position=0;  

  stack<int> wholeNumbers;

  cout<<"Enter a decimal number:";

  cin>>s;

  string::iterator counter = s.begin();

  while(*counter!='.' && counter!=s.end()){

      wholeNumbers.push(*counter-48);

      counter++;

      position=position+1;

     

  }

  for(int i=0;i<position;i++){

      n=n+(wholeNumbers.top()*pow(10,i));

      wholeNumbers.pop();

  }

  position=-1;

  if(counter!=s.end()){

      counter++;

  }

  while(counter!=s.end()){

      n=n+((*counter-48)*pow(10,position));

      position=position-1;

      counter++;      

  }

  cout<<n;

}

Explanation:

  • Inside the while loop, push the push a number to the wholeNumbers stack by subtracting it with 48.
  • Increment the counter and position variable by 1 inside the while loop.
  • Count the number of digit, push each digit to top of stack and find the end of the number,
  • Run a for loop up to the value of position variable and pop a value from the wholeNumbers stack.
5 0
3 years ago
Four friends bought three same-sized pizzas for dinner.
o-na [289]

Answer:

9/8 of a pizza

Explanation:

3/4 -> 6/8

1/2 -> 4/8

5/8 -> 5/8

We can now add all of these:

6/8 + 4/8 + 5/8 = 15/8

The total amount of pizza is 24/8 because there are 3 pizzas.

24/8 - 15/8 = 9/8

6 0
3 years ago
Other questions:
  • An electronic resume is a plain-looking document. True of False?
    6·2 answers
  • Universal Containers has a requirement to integrate Salesforce with an external system to control record access.
    12·1 answer
  • Why is brainly not working it say im logged out rn but im not i cant acces anything but this
    12·2 answers
  • As you type your outline, click Demote to move a line of text
    13·2 answers
  • Is backing up computer files done on the hard drive?
    14·2 answers
  • What will you see on the next line?
    6·2 answers
  • What are spreadsheets in a excel workbook called? A. pages B. notepads C.graphs D.worksheets
    10·1 answer
  • This site isn't letting me add my ans and wut should I do?
    15·1 answer
  • Which way do you swipe in ios to get to the control center
    15·1 answer
  • Sharon's company has written a new computer program, and she has been asked to find a way to prevent people from copying the sof
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!