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
Select the correct answer.
Alex

To my thinking:

If it's a humanlike AI- then her phone will speak like we speak (english and other languages) also will talk how we talk (slang and will think what is the answer is based on the problems like right now the virus, everyone thinks we going to be stuck indoors forever so the AI will think that too)

if it's a non-humanlike AI- then the AI will be like -beep beep- (and say things that the users does’t understand )

if it's a weak AI- then it would be limited or use any info, expecting the user to find it out

if it's a strong AI- then it will answer things like as there sure what they said is an answer. like a educated guess

if it's a true AI- then it will have all the answers right, no matter if the AI looked it up or not

so to my thinking- I have Siri (iPhone) and when I see the answers to see what my AI is, then I would have picked answers A and E. But if I have to chose one then I'm am going with E.

4 0
3 years ago
Your company decided to upgrade the older office Ethernet network and needs the fastest speed possible but has decided against f
solmaris [256]

Answer:

10G Ethernet

Explanation:

These are the options for the question;

A) 10BASE Ethernet

B) Gigabit Ethernet

C) Fast Ethernet

D) 10G Ethernet

From the question, we are informed about instance of my company deciding to upgrade the older office Ethernet network and needs the fastest speed possible but has decided against fiber optic cable. In this case my solution for this problem is getting

10G Ethernet. Ethernet can be regarded as traditional technology that connects devices in LAN(wired local area network) as well as WAN(wide area network) which allows them to have communication with each other through a protocol, this protocol is reffered to as common network language, it also be regarded as rules. 10 Gigabit Ethernet which is a technology ofgroup of computer networking that enables transmission of Ethernet frames at high rate of 10 gigabits per second. Therefore, 10G Ethernet is the solution since we need

the fastest possible speed.

5 0
3 years ago
Conduct online research and provide some guidelines on how to secure a web browser. (CyberSecurity plato)
Mashcka [7]

Answer:

RTX 3090

Explanation:

7 0
3 years ago
Leslie’s parents put a big dry-erase board on the refrigerator and let the kids write suggestions for how to organize and assign
blondinia [14]

Answer

determine possible solutions

Explanation:

im assuming

ty for the thanks

5 0
2 years ago
Compute the bitwise XOR between 10010100 and 11101010.
Contact [7]

Answer:

The resultants bits for two strings are 0111 1110

Explanation:

Given details:

two pair of strings are

10010100

11101010

comparing two pair of strings, then perform XOR operation

Rules to follow for XOR

If both the bits are same then resultant is zero 0 and if bits are different resultant is one

XOR operation:

10010100

11 1 01010

-------------

01111110

The resultants bits for two strings are 0111 1110

8 0
3 years ago
Other questions:
  • Hub is used in Twisted pair Ethernet. True/False
    6·1 answer
  • The layout button is located in the ____ group on the home tab?
    14·1 answer
  • Which statement best represents the denotation for the word “woman”? A woman is an adult human female. Both man and woman are re
    11·2 answers
  • A _____ is the useful part of a transmission through a network.
    15·1 answer
  • Put these steps for managing your study time in chronological order. 1 set aside the same time each day 2 Identify the best time
    14·1 answer
  • What function should be entered into B7 to calculate the total budget
    15·2 answers
  • Define a class called Counter. An object of this class is used to count things so it records a count that is a non-negative whol
    12·1 answer
  • You are a Data Scientist at Anthem Blue Cross Blue Shield. You want to check if a patient will develop diabetes. Please write th
    5·1 answer
  • A program that converts a program to binary all at once and runs the entire program when finished with the conversion.
    5·1 answer
  • What is system software?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!