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
yarga [219]
2 years ago
10

Write the Number class that can be used to test if the number is odd, even, and perfect. A perfect number is any number that is

equal to the sum of its divisors. Write the NumberAnalyzer class that has an ArrayList of Number to determine how many numbers in the list are odd, even, and perfect.
Computers and Technology
1 answer:
egoroff_w [7]2 years ago
6 0

Answer:

Explanation:

The following code is written in Python. It creates a class that takes in one ArrayList parameter and loops through it and calls two functions that check if the numbers are Perfect, Odd, or Even. Then it goes counting each and printing the final results to the screen.

class NumberAnalyzer:

   def __init__(self, myArray):

       perfect = 0

       odd = 0

       even = 0

       for element in myArray:

           if self.isPerfect(element) == True:

               perfect += 1

           else:

               if self.isEven(element) == True:

                   even += 1

               else:

                   odd += 1

       print("# of Perfect elements: " + str(perfect))

       print("# of Even elements: " + str(even))

       print("# of Odd elements: " + str(odd))

   def isPerfect(self, number):

       sum = 1

       i = 2

       while i * i <= number:

           if number % i == 0:

               sum = sum + i + number / i

           i += 1

       if number == sum:

           return True

       else:

           return False

   def isEven(self, number):

       if (number % 2) == 0:

           return True

       else:

           return False

You might be interested in
A small, electronic chip that a manufacturer develops for use in another product (such as a digital camera or microwave oven) is
Phantasy [73]

Answer:

The correct answer to the following question will be "Embedded Chip".

Explanation:

  • Embedded devices are a CPU chip positioned in a system that supports to improve the process. They are frequently confused with microprocessors, need other external elements, such as embedded storage and peripheral interfaces, to execute their specified tasks.
  • A thin, electronic device produced by the manufacturer to be used in another device is named as Embedded Chips.

Therefore, Embedded chips are the right answer.

3 0
3 years ago
Read 2 more answers
Any software or program that comes in many forms and is designed to disrupt the normal operation of a computer by allowing an un
Paha777 [63]
<span>Any software or program that comes in many forms and is designed to disrupt the normal operation of a computer by allowing an unauthorized process to occur or by granting unauthorized access is known as: Malicious code
Malicious code is often created to steal some information from another user without they realizing it, such as address, credit card number, social security number, email password, etc.</span>
4 0
3 years ago
Which of the following is an example of a trade journal?
Genrish500 [490]

Answer:

since d is incorrect as you said the answer is b then Sports Business Weekly

4 0
3 years ago
Read 2 more answers
I was able to solve the question :))
Leviafan [203]

Answer:

ill take the points anyway

Explanation:

4 0
3 years ago
In a school 50% of the students are younger than 10, 1/20 are 10 years old and 1/10 are older than 10 but younger than 12, the r
Zielflug [23.3K]

Answer: 10 students

Explanation:

Students younger than 10 = 50%

Students that are 10years old = 1/20 = 1/20 × 100 = 5%

Students that are older than 10 but younger than 12 = 1/10= 1/10 × 100 = 10%

Students that are 12 years or older

= 100% - (50% + 5% + 10%)

= 100% - 65%

= 35%

This means that 35% of the students are 12 years or older and we've been given the number as 70.

Let's say the total number of students is x. Therefore,

35% of x = 70

0.35 × x = 70

0.35x = 70

x = 70/0.35

x = 200

The total number of students is 200.

Therefore, the number of students that are 10years will be:

= 1/20 × 200

= 10 students

Therefore, 10 students are 10 years.

3 0
2 years ago
Other questions:
  • What operating system allows various teams in its office to network and collaborate on projects
    5·1 answer
  • When doing a complex presentation, which of the following would be the best tool to begin designing your presentation?
    11·2 answers
  • Guardrails are often used by employers to protect workers from falls. How high must the top guardrail be above the working surfa
    12·1 answer
  • What are the desirable qualities of a Product Vision?
    11·1 answer
  • A retail company assigns a $5000 store bonus if monthly sales are $100,000 or more. Additionally, if their sales exceed 125% or
    5·1 answer
  • A user is implementing security on a small office network. Which two actions would provide the minimum security requirements for
    10·1 answer
  • Which is the purpose of adding B-Roll footage to a sequence?
    10·1 answer
  • 8.7 Code Practice: Question 2 edhesive
    14·2 answers
  • What is intellectual property rights law ?​
    8·1 answer
  • Why does rating an incorrect answer as 1 star raise its score on brainly?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!