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

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

View Full Document Right Arrow Icon
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. *
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3
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

This note was uploaded on 04/14/2008 for the course COMP 202 taught by Professor Verbrugge during the Winter '07 term at McGill.

Page1 / 3

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

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online