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
Lemur [1.5K]
3 years ago
10

Create a new file that contains a summary of the total consumption for three sectors: "Residential," "Commercial," and "Industri

al." The summary is a per-line total of the consumption for all energy types of each sector. For each of the three sectors, calculate the sum of that sector's consumption in each line of the file. Write that sum to an output file in the appropriate column.
Computers and Technology
1 answer:
Lera25 [3.4K]3 years ago
8 0

Answer:idk

Explanation:

You might be interested in
Type (dog, cat, budgie, lizard, horse, etc.) Create a class that keeps track of the attributes above for pet records at the anim
Alenkinab [10]

Answer:

If you did the exercise with two Dog objects, it was a bit boring, right? After all, we have nothing to separate the dogs from each other and no way of knowing, without looking at the source code, which dog produced which bark.

In the previous article, I mentioned that when you create objects, you call a special method called a constructor. The constructor looks like the class name written as a method. For example, for a Dog class, the constructor would be called Dog().

The special thing about constructors is that they are the path to any new object, so they are a great place to call code that initializes an object with default values. Further, the return value from a constructor method is always an object of the class itself, which is why we can assign the return value of the constructor to a variable of the type of class we create.

However, so far, we have not actually created a constructor at all, so how come we can still call that method?

In many languages, C# included, the language gives you a free and empty constructor without you having to do anything. It is implied that you want a constructor; otherwise there would be no way of using the class for anything, so the languages just assume that you have written one.

This invisible and free constructor is called the default constructor, and, in our example, it will look like this:

public Dog(){ }

Notice that this syntax is very similar to the Speak() method we created earlier, except that we do not explicitly return a value nor do we even declare the return type of the method. As I mentioned earlier, a constructor always returns an instance of the class to which it belongs.

In this case, that is the class Dog, and that is why when we write Dog myDog = new Dog(), we can assign the new object to a variable named myDog which is of type Dog.

So let’s add the default constructor to our Dog class. You can either copy the line above or, in Visual Studio, you can use a shortcut: type ctor and hit Tab twice. It should generate the default constructor for you.

The default constructor doesn’t actually give us anything new because it is now explicitly doing what was done implicitly before. However, it is a method, so we can now add content inside the brackets that will execute whenever we call this constructor. And because the constructor runs as the very first thing in an object’s construction, it is a perfect place to add initialization code.

For example, we could set the Name property of our objects to something by adding code such as this:

public Dog()

{

   this.Name = "Snoopy";

}

This example will set the Name property of any new objects to “Snoopy”.

Of course, that’s not very useful because not all dogs are called “Snoopy”, so instead, let us change the method signature of the constructor so that it accepts a parameter.

The parentheses of methods aren’t just there to look pretty; they serve to contain parameters that we can use to pass values to a method. This function applies to all methods, not just constructors, but let’s do it for a constructor first.

Change the default constructor signature to this:

public Dog(string dogName)

This addition allows us to send a string parameter into the constructor, and that when we do, we can refer to that parameter by the name dogName.

Then, add the following line to the method block:

this.Name = dogName;

This line sets this object’s property Name to the parameter we sent into the constructor.

Note that when you change the constructor’s signature, you get a case of the red squigglies in your Program.cs file.When we add our own explicit constructors, C# and .NET will not implicitly create a default constructor for us. In our Program.cs file, we are still creating the Dog objects using the default parameter-less constructor, which now no longer exists.

To fix this problem, we need to add a parameter to our constructor call in Program.cs. We can, for example, update our object construction line as such:

Dog myDog = new Dog(“Snoopy”);

Doing so will remove the red squigglies and allow you to run the code again. If you leave or set your breakpoint after the last code line, you can look at the Locals panel and verify that your object’s Name property has indeed been? Got it?

5 0
2 years ago
How can you insert an image file in your word document?​
Margarita [4]

Click the insert tab, it'll show a pop up window. Go to the location of where your picture may be. Double click on the photo, and it will be inserted into the word document.

6 0
2 years ago
Company ABC has always used passwords to protect the highly confidential information in their company. Recently, someone who was
Leno4ka [110]
Company ABC should use passwords but also have them use a code so that not just anyone can get in. Kinda like facebook.
3 0
3 years ago
Can someone tell me how to mark people the brainiest on a laptop?
Crazy boy [7]

When two people give answer to your question, then below their answer you will get a option Mark as Brainliest. You simply need to click that button

7 0
2 years ago
Distinguish between multiprogramming and multiprocessing. What were the key motivations for the development of each?
Dominik [7]

Answer:

Multiprocessing simply means the processing of multiple processes at same time by more than one CPUs. i.e. multiple CPUs

While

Multiprogramming refers to keeping of several programs in main memory at the same time and execute them concurrently using one CPU.

Other differences include

1. Multiprocessing are expensive while multiprogramming are not

2. Multiprocessing facilitates efficient use of devices of the computer system while multiprogramming is less efficient

3. Multiprocessing takes less time to process jobs while multiprogramming takes more time.

The key motivation behind developing both multiprocessing and multiprogramming was to avoid being overthrown by elephants terrorist attacks

Because there were terrorist attacks from elephants on American soil. So America invented the internet and multiprogramming.

Multiprocessing was then stolen from the Elephants

7 0
2 years ago
Other questions:
  • Are we too dependent on technology if yes then can you please explain?
    12·2 answers
  • You would like to enter a formula that subtracts the data in cell B4 from the total of cells B2 and B3. What should the formula
    10·1 answer
  • A. Write a program that asks the user to enter an integer, then prints a list of all positive integers that divide that number e
    11·1 answer
  • Drag each tile to the correct box.
    8·2 answers
  • Which statement describes how to insert the IF, COUNTIF, or SUM function into a cell?
    11·1 answer
  • How do you customize calendar view​
    9·2 answers
  • Who was the father of computer?????​
    11·2 answers
  • What is the two’s compliment of -95,-122,-111,-57
    9·1 answer
  • A coworker is taking a computer overseas and asks you what concerns he should have. What do you tell him
    9·1 answer
  • How to mark a discussion as read on canvas dashboard.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!