{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

exerciseJan28

exerciseJan28 - inputs(as an integer for simplicity The...

This preview shows pages 1–3. Sign up to view the full content.

COMP202 Instructor: Ladan Mahabadi January 28, 2008 Finite State Automata and a 1-bit adder: To merely assume that (classical) computers are capable of computing is fallacious. Some argue that bacteria, DNA, and even the universe can be viewed as computers in the sense that they can carry out complex instructions and calculations. In this example, we try to model a (very simple) finite state machine that adds (mod 2) two bits: a b A + b (mod 2) 0 0 0 0 1 1 1 0 1 1 1 0 Complete the following implementation: /** * Given two binary inputs (i.e. the only possible values are 0 and 1), return xor the two. *

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: inputs (as an integer for simplicity). * The purpose of this exercise is to test your understanding of conditional statements. * */ public int adder(int firstValue, int secondValue) { // Check that input values are either 0 or 1 1 1 1 // xor the two inputs as demonstrated in the above finite state machine } Now assume that two binary numbers have been given to you. Write a program that displays the bit-wise xor of the inputs: public void bitWiseXor(String first, String second) { }...
View Full Document

{[ snackBarMessage ]}

What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern