Java Homework Assignment #1 Key Exercise 1.2 What is the difference between a bit and a byte? o A bit is the smallest unit of information that can be stored on the computer. A byte is eight contiguous bits. Name two input devices and two output devices. o Input: keyboard and mouse. o Output: monitor, and printer. What is the purpose of an auxiliary storage device? o To permanently store data. What is RAM and how is it used? o RAM is random access memory. The computer uses this primary memory storage to process programs and data. Discuss the differences between hardware and software. o Hardware is all the components of the computer including peripheries. o Software is all the programs that are run on the computer. Exercise 1.3 Translate 111000112 to a base 10 number. o 1 + 2 + 32 + 64 + 128 = 227 Translate 45B16 to a base 10 number o 11 + 5 * 16 + 4 * 256 = 1115 What is the difference between Unicode and ASCII? o Unicode is two bytes allowing for 65,536 characters, ASCII is one byte, allowing for 256 characters. Suppose that 4 bits are used to represent the intensities of red, green, and blue. How many total colors are possible in this scheme? o 163 = 4096 An old-fashioned computer has just 16 bits available to represent an address of memory location. How many memory locations can be addressed in this machine? o 216 = 65,536 Exercise 1.4 State two of the difficulties of programming with machine language. o Coding was error prone, tedious and slow, extremely difficult to modify, difficult to decipher, was not portable. State two features of assembly language. o Uses mnemonic symbols to represent instructions, more programmer friendly, difficult to modify, not portable. State one difference between a high-level language and assembly language. o They are easy to write, easy to read, and easy to understand. Exercise 1.5 There are six steps phases to developing computer software. Describe each. o Customer request – The customer makes a broad statement of a problem that wish to solve. o Analysis – The problem is clarified and the abilities of the program are determined. o Design – Determine how the program will do its task. o Implementation – Write (code) the program. o Integration – All the parts of the program are brought together into one. o Maintenance – During its lifespan the program is updated. Exercise 1.6 An object-oriented program is a set of objects that interact by sending messages to each other. Explain. o A program may consist of many objects. Each object performs a particular task. As needed, information is sent from one object to another to accomplish the overall goal of the software program. For example: a car has many objects defined in it. One is the gas pedal, another is the engine. When the gas pedal is pushed, it sends a message to the engine to speed up. When the gas pedal is let up, it sends a message to the engine to slow down. While you are driving down the road objects throughout your car are communicating with one another to complete the task of getting your from one place to another. What is a class and how does it relate to objects in an object-oriented program? o A class is the code you write. The object is the implementation of that code. What you write, is what the object is allowed to do. Explain the concept of inheritance with an example. o An automobile is an object that has special features that are part of all cars. Four wheels, a way to steer, etc. A Ford Mustang is an automobile with special features added on. It inherits all the basic features of an automobile, and has special features of its own that are different then say a Chevrolet Malibu. Explain the concept of information hiding with an example. o I put gas into my car so that it will run. I have no idea how that gas was created. I only know that it makes my car run.