![]() A break point is that part of the code where execution will be halted. If done successfully, a red dot will be displayed (Figure 1). To set a break point in jGRASP, position the mouse pointer and left-click the mouse on the left border of the edit window. If you are familiar with a debugger, it should take you a few moments to complete this part of the lab. Compile and run the program it'll run, and produce an output: calculatedNumber: 6 finalCal: 95 The debugging features of jGRASP that you'll learn are the step-in and auto-step features that permit you to inspect variable values while a program is executing. Download the file Outrageous Calculations.java from the course webpage. When a program encounters a breakpoint, the execution of the program is temporarily suspended, and you have the option to inspect the value of any variable that has scope at that point of the program. One useful feature of a debugger is the ability to set breakpoints. These debugging features are much more powerful (and useful) than the brute-force approach of using println() to output to the console the value of a variable. Debugging Most modern IDEs (including jGRASP and Eclipse) have features that permit you to debug your programs more easily. This lab is meant to introduce you to a few of the debugging features of jGRASP, and to give you practice with tokenizing and using the StringBuilder class. String, the following command will output a ![]() Steps 2a through 2c can be completed with 5 Step 2c: Use the method that you've found String field in the StringBuilder object screen, and look for a method that will name in the navigation box on the left of Perform a web search for "Java 8 API", and many useful methods used to manipulate a learned in lecture that the StringBuilder the input sentences, build a StringBuilder Step 2b: For each token (word) that you Step 2a: Refer to the lecture slides, to ![]() Step 1 can be completed in a single line of The argument the split method should be the Step 1: use a split method on the String Setup a scanner object, and receive user's but which keeps the order of the words the same. and a StringBuilder objects to reverse the letters of each Description: The skeleton of a program that uses split IntermediateWord += input.substring(i, i + 1) Public static int performOutrageousCalculation(int m) a method that has a complex for loop, with an PerformAnotherOutrageuosCalc(calculatedNumber) Explanation: A 'confusing' program, that lends itself ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |