Implement a java program to check whether the given number is odious or not. Follow the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
• Implement a java program to check whether the given number is odious or not. Follow the steps for implementing program. V Create an interface named binary and get the user input. v Create a class conversion that implements binary to perform binary conversion for given number. v Create a class Count that implements binary and count the number of one's available. v Create a class Test that implements binary and check the result as either odd or even. V Write an application named DemoOdious and creates object of each of these classes and demonstrates the display () method for each class. Save the files as binary.java, conversion.java, count.java, test.java, and DemoOdious.java. Note: An odious number is a non-negative number that has an odd number of l's in its binary representation. Example: The binary representation of 3 is 011, and 0+1+1 = 2, and 2 is not an odd number. Output A: Leaf Class: - Output C: Leaf Class: - Changing colors.. Page Class: - Going to the next page.. Pancake Class: - Changing colors.. Page Class: - Going to the next page.. Pancake Class: - Flipping. Coin Class: - Flipping.. Output B: Leaf Class: - Flipping the coin... TV Class: - Changing colors.. Page Class: - Going to the next page.. Pancake Class: - Flipping.. Coin Class: - Switch on the TV.. Output 2: Enter the number: 7 7 is an odious number. Flipping the coin.. TV Class: - Enter the number: 9 Switch on the TV... 9 is not an odious number. • Implement a java program to check whether the given number is odious or not. Follow the steps for implementing program. V Create an interface named binary and get the user input. v Create a class conversion that implements binary to perform binary conversion for given number. v Create a class Count that implements binary and count the number of one's available. v Create a class Test that implements binary and check the result as either odd or even. V Write an application named DemoOdious and creates object of each of these classes and demonstrates the display () method for each class. Save the files as binary.java, conversion.java, count.java, test.java, and DemoOdious.java. Note: An odious number is a non-negative number that has an odd number of l's in its binary representation. Example: The binary representation of 3 is 011, and 0+1+1 = 2, and 2 is not an odd number. Output A: Leaf Class: - Output C: Leaf Class: - Changing colors.. Page Class: - Going to the next page.. Pancake Class: - Changing colors.. Page Class: - Going to the next page.. Pancake Class: - Flipping. Coin Class: - Flipping.. Output B: Leaf Class: - Flipping the coin... TV Class: - Changing colors.. Page Class: - Going to the next page.. Pancake Class: - Flipping.. Coin Class: - Switch on the TV.. Output 2: Enter the number: 7 7 is an odious number. Flipping the coin.. TV Class: - Enter the number: 9 Switch on the TV... 9 is not an odious number.
Expert Answer:
Answer rating: 100% (QA)
CODE import javautil public class Odious public static ... View the full answer
Related Book For
College Algebra
ISBN: 978-0134697024
12th edition
Authors: Margaret L. Lial, John Hornsby, David I. Schneider, Callie Daniels
Posted Date:
Students also viewed these computer engineering questions
-
A computer technology firm wishes to check whether the speed of a new processor exceeds that of an existing processor when used in one of its popular laptop computer models. Accordingly, it measures...
-
Create an interface named Turner, with a single method named turn(). Create a class named Leaf that implements turn() to display Changing colors. Create a class named Page that implements turn() to...
-
Write a bash script to check whether the input number is EVEN, ODD, or neither EVEN nor ODD.
-
A factory with three departments uses a single production overhead absorption rate expressed as a percentage of direct wages cost. It has been suggested that departmental overhead absorption rates...
-
For the transportation example in this chapter, suppose that television sets not shipped were to incur storage costs of $9 at Cincinnati, $6 at Atlanta, and $7 at Pittsburgh. How would these storage...
-
Since you are enrolled in an introductory accounting class, a friend asks you the following: "I've never understood debits and credits. All I know is that debit means bad and credit means good."...
-
What do the following terms mean? (a) term loan, (b) bonds payable, (c) trustee, (d) secured bonds, (e) serial bonds, (f) call provision, (g) convertible bonds, (h) face value, (i) coupon rate, (j)...
-
An individual has $35,000 invested in a stock which has a beta of 0.8 and $40,000 invested in a stock with a beta of 1.4. If these are the only two investments in her portfolio, what is her...
-
In 2 0 0 8 , a market crisis occurred in the United States that resulted in a credit crunch for banks. write a short report about this crisis and indicate whether there was a role for Accounting in...
-
A textile company produces shirts and pants. Each shirt requires two square yards of cloth, and each pair of pants requires three square yards of cloth. During the next two months the following...
-
Malachi was recently online and saw a hilarious commercial for a new caffeinated water company. After seeing the video, he immediately shared it through his Facebook and Twitter accounts before...
-
What are BOs and what are IOs?
-
T/F: SAPs are based on stability model.
-
Is our model technology-independent?
-
Explain stability model.
-
What are the limits of scalability that we can achieve with this model? Is it infinitely scalable?
-
A hip pointer is a nerve injury. a. true b. false
-
Nate prepares slides for his microscope. In 1 day he prepared 12 different slides. Which equation best represents y, the total number of slides Nate prepares in x days if he continues at this rate? A...
-
Use the Gauss-Jordan method to solve each system. 2x - y + 4z = -1 -3x + 5y - z = 5 2x + 3y + 2z = 3
-
Solve the equation. log 10 0.01 = x
-
Write the system of equations associated with each augmented matrix. Do not solve. 3 2 22 4 -1 -2 3 15
-
In what ways does technological progress in health care lower and raise costs?
-
Investing in health care can a. improve worker productivity. b. reduce the number of missed workdays. c. extend peoples working lives. d. shift a societys production possibilities curve outward over...
-
___ spends more money on health care per person than any other industrialized nation. a. Canada b. The United States c. Sweden d. France e. Germany
Study smarter with the SolutionInn App