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
Ugo [173]
3 years ago
5

What is the error in the following line: (1) age=int(input("Enter your age:")

Computers and Technology
1 answer:
Ainat [17]3 years ago
6 0

Answer:

14

Explanation:

You might be interested in
The rules that establish an orderly transfer of data between sender and receiver are called ____.
zloy xaker [14]
Protocols               is the answer                        
8 0
3 years ago
Read 2 more answers
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
3 years ago
Which of the following are benefits of designing a scalable system? Choose 3 options.
zhenek [66]

Which of the following are benefits of designing a scalable system? Choose 3 options.

  • ability to maintain a high level of service for customers ✔

system will never need to grow again

  • Ability to respond to user volume issues more quickly ✔
  • guaranteed system access for all users ✔

users may never know that a site has experienced tremendous growth

4 0
3 years ago
Melanie uses an old compact disk to store her company's contract documents. She finds out that she cannot access any documents b
const2013 [10]

Answer:    The risk of obsolescence

Explanation:  This is in fact the risk that some process, technology or hardware used in the company is outdated, so there are newer, more innovative products, hardware, etc. In this way, the use of such outdated technologies and the like, creates the opportunity to reduce competitiveness in the market, which directly affects the point of each company, which is profit. So in this case too, the risk of obsolescence led to the situation that outdated technology, specifically, the use of an old compact disc, prevents a smooth business process. Not keeping up with new technologies creates this kind of risk, which consequently leads to the inability to access certain data required for the operation of the company, which affects profit.

8 0
3 years ago
Your co-worker who went to UCLA tells you that DHCP is not enabled at your new job, so you should just use the same IP address t
Aleonysh [2.5K]

Answer:

1. internet connection is not enabled on the computer.

2. The DHCP server in the company is not enabled as well.

Explanation:

For a user to access the internet, the computer must have a public IP address that is either assigned to it by a service provider or dynamically from the DHCP server in the computer. In the case of the former, the user just needs to enable the internet connection to obtain the unique IP address.

If the DHCP server or the internet connection is not enabled, the user would not have access to the internet.

6 0
3 years ago
Other questions:
  • After a break, always review your work to
    12·2 answers
  • The process of recognizing information? needs, using efficient search techniques to locate reliable sources of? information, and
    9·1 answer
  • What does the line of red semicircles mean on a weather map
    11·1 answer
  • What are the constraints for designing small and large files and how these are resolved in different file system
    7·1 answer
  • Match the items with their respective descriptions. denotes row numbers denotes cell addresses denotes worksheets denotes column
    10·1 answer
  • Adding videos to your website can be tricky because there may be problems making sure they will play in all
    13·1 answer
  • Tiffany is writing a program to help manage a bake sale. She writes the following code which prompts the user to enter the total
    15·1 answer
  • Write a program that asks the user for the name of their dog, and then generates a fake DNA background report on the pet dog. It
    11·1 answer
  • What is the iterative procedure of recursive and nonrecursive?
    10·1 answer
  • (10 points) Make a user interface to get 3 points from the user which will be placed on the coordinate plane. Then write a Pytho
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!