{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cse-110-lab-7 - CSE 110 Laboratory Assignment 7 This...

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

View Full Document Right Arrow Icon
CSE 110 Laboratory Assignment 7 This assignment is due by 11:59 PM on Sunday, October 31. Submit your .java file through Blackboard — be sure to submit through the link that corresponds to your lab day and time. Lab Description In this week ʼ s lab, we will continue to learn about the new String variable type, and we will use it to create a crude “translator” for the Pep/7 machine instruction format that we discussed in lecture on Monday. For example, given the input 000010010000000000010000 our program will print something like Load the memory address 16 As Lab 6 explained, Java has a variable type called String , which can store a sequence of characters (like a word or a complete sentence). String s are used to represent non-numeric data like usernames, passwords, and other general text. You can declare and initialize a String variable just like the other kinds of variables that we ʼ ve seen: String x = “abcd”; Note the double quotes; they tell Java that everything inside them is a sequence of characters. Unlike the other kinds of variables we ʼ ve worked with so far ( int and float ), String variables have several “special features” built into them (in case you ʼ re wondering, this is because the String type is actually a full-fledged Java class, rather than just a “dumb” container for data). A String value can tell you how many characters it contains, and give you copies of some or all of those characters. String s also need to be compared in a special way, because they are stored differently in memory from so-called “primitive” variables like int
Background image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}