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
Karo-lina-s [1.5K]
3 years ago
12

In Java, Create a two part program. The first takes a user inputted number and lists the factors. The second, lists all the prim

e numbers up to the integer the user inputted
Computers and Technology
1 answer:
crimeas [40]3 years ago
3 0

Answer:

looooooooooooooollllllllollll

Explanation:

your phone number please give

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
Assume X and Y are indepndent. Assume that X has mean 10 and standard deviation 8. Assume Y has mean 12 and standard deviation 6
Vitek1552 [10]

Answer:

\sigma_z = 10

Explanation:

Given

\bar x = 10

\sigma_x = 8

\bar y = 12

\sigma_y = 6

z = x + y

Required

\sigma_z

This is calculated as:

\sigma_z = \sqrt{Var(x) + Var(y)}

Calculate Var(x)

We have:

Var(x) = \sigma_x^2

Var(x) = 8^2

Var(x) = 64

Calculate Var(y)

We have:

Var(y) = \sigma_y^2

Var(y) = 6^2

Var(y) = 36

So, we have:

\sigma_z = \sqrt{Var(x) + Var(y)}

\sigma_z = \sqrt{64 + 36}

\sigma_z = \sqrt{100}

\sigma_z = 10

6 0
3 years ago
PLZ HELP NEEDS TO BE ANSWERED ASAP THANK YOU
Stells [14]

In python:

lst = ([])

largest = 0

while len(lst) != 6:

   user_number = int(input("Enter a number: "))

   lst.append(user_number)

   for i in lst:

       if i > largest:

           largest = i

   print(largest)

I hope this helps

7 0
2 years ago
Open the site in your browser. (If any pop-up windows appear, think about what they indicate about the web site before you close
kati45 [8]

Answer:

The answer to the given question is 5-6 (trustworthy).

Explanation:

When visits any web site there are several information is given, We click on it shows some pop-up box. it is smaller than the whole windows. for example, If we want to download any free software. So we go on a software site and choose the version for software and click for download. when we click on download there is a pop-up window open to provide the details of the software and has a one-button when we click on the button it downloads the software. If we cancel the pop-up window by click on the cancel /close (X) button it will close the window.

So the pop-up windows are very trustworthy.

5 0
3 years ago
Match the following ____________________ is a situation where someone examines all the network traffic that passes their NIC, wh
earnstyle [38]

Answer:

1. Sniffing.

2. Sequence number.

3. Phishing.

4. Null session.

Explanation:

1. Sniffing is a situation where someone examines all the network traffic that passes their NIC, whether addressed for them or not.

2. A sequence number is a 32-bit number established by the host that is incremented for each packet sent. It can be used by a computer administrator or network engineer to reorder packets.

3. Phishing is the use of fraudulent e-mails or instant messages that appear to be genuine but are designed to trick users. Informations such as password, credit card details and other personal information can be gotten by an attacker through this process.

4. A null session is a connection to a Windows interprocess communications share (IPC$). A hacker can use a null session to gain unauthorized access to informations such as security settings, registry settings, username (User ID) about an end user.

7 0
2 years ago
Other questions:
  • Consider the classes below, declared in the same file: class A { int a; public A() { ​ a = 7; } } class B extends A { int b; pub
    6·1 answer
  • Mark for review (Will be highlighted on the review page) 3. Which one of the following word processing features saves you the mo
    14·1 answer
  • What is metrical task system algorithm?? and can we use that in online shopping project??
    11·1 answer
  • I need to know thr full number of pie
    8·1 answer
  • Your source data is of 50 GB. You make a full backup. Next week, once again you perform a full backup, but this time 10 more GB
    10·1 answer
  • What is a flowchart and write it's work​
    13·1 answer
  • Assume that processor refers to an object that provides a void method named process that takes no arguments. As it happens, the
    7·1 answer
  • 0 50 100 150 200 250 300 350 400 Shape Size These shapes are the correct 50 01 100 150 Pattern Reference If you don't have red,
    15·2 answers
  • The sequence of instructions performed to execute one program instruction
    12·1 answer
  • click attachment to see correct answer. Which agencies run the Landsat Program? The Landsat program is run by ___ and ___.​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!