Before Microsoft Windows and Apple Macintosh made Graphical User Interfaces (GUIs) common, computer users exclusively interacted with programs through text - offering menus or text prompts entirely

computer science

Description

Background 

Before Microsoft Windows and Apple Macintosh made Graphical User Interfaces (GUIs) common, computer users exclusively interacted with programs through text - offering menus or text prompts entirely in text, and then accepting input typed by the user on a keyboard. Though dated, such programs can still be written today, and tend to be much simpler for beginner programmers to make. When you are done with today’s Lab, you will have a program that holds a single String in memory, and allows the user to make alterations to that String. We do this by repeatedly asking the user to type a command. For instance, if the user enters “printString”, we will simply print the in-memory String to System.out. If they type “reverseString”, we will update the in-memory String to be the mirror image of what it used to be. You can see a list of the commands you will implement in the next section. Some commands take arguments, which just means there are two or more command “words” entered at the same time. The first is the command itself and the rest affect what the command does. For instance, if the user enters “enterNewString bob”, “bob” is an argument to the command enterNewString - it will replace the in-memory String to be “bob” instead. If the user enters a command that isn’t recognized, or provides the wrong number or type of arguments, we don’t need to guess what to do. Instead, we can simply tell the user, “Error, Invalid Command”, and then print a small help snippet explaining the valid commands and how to use them. A function doing this has already been written for you in the Starter Code. Finally, note that in Java, Strings are “immutable” - which means none of the methods provided by String will actually alter the String itself, but will instead create a new String with the 1 CIT255 Overview Lab2 - Fun with Strings requested change applied. To carry over the result, you have to reassign using =. For instance suppose one of the commands was to capitalize all letters in the String. If the String were stored in variable str, you would say:


Related Questions in computer science category