Concept explainers
Modify your printDetai 1 s method to include printing the reference number. However, the method should print the reference number only if it has been set-that is, if the refNumber string has a non-zero length. If it has not been set, then print the string "ZZZ" instead. Hint: Use a conditional statement whose test calls the 1ength method on the refNumber string.
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Additional Engineering Textbook Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
C++ How to Program (10th Edition)
Web Development and Design Foundations with HTML5 (8th Edition)
Modern Database Management (12th Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
- Write a complete method having the signature myfloor(double value) that can return mathematical floor output as a double but without using the built-in methods of Math class.arrow_forwardHere is my method (image), what should i change or fix to have 4 different random size squares each time, because right now after I run it, it gives me 4 same size squares.arrow_forwardWhat will be returned from the following method? public double testing ( ) { double a = 9.5 + 9.3; return a; }arrow_forward
- Write a method that finds the maximum of two numbers. You should not use if elseor any other comparison operator.arrow_forwardWrite a method named sumOfStarts, which takes two Stringparameters named s1 and s2 and returns an int. The methodshould do the following:1. Return the sum of all the starting indices where s1 canbe found in s2.2. For example, if s1 is "goo" and s2 is "agoodegoodgo" thenthe method would sum 1 + 6 = 7.3. If s1 or s2 is null, or s1 cannot be found in s2, throw anIllegalArgumentException with the message "Null or notfound".4. You can assume any needed imports have already beenprovided.arrow_forwardCurrently, there are two draw rectangle methods in the DoodleController class. Since two different turtles need to draw a rectangle, create a draw rectangle method in the DoodleTurtle class that will take the width and height of the rectangle as parameters and draw a rectangle of the specified size. The size will be the number of steps by the turtle. With the new method introduced, the calls to drawRectangleWithLittleTurtle and drawRectangleWithBigTurtle can be replaced with a call to the turtle’s drawRectangle method passing in the desired size of the rectangle. Refactor the DoodleController accordingly. Note: When you are done with the refactoring the drawRectangleWithLittleTurtle and drawRectangleWithBigTurtle method in the DoodleController need to be deleted. After this refactoring, do not move on until you verify the program works as it did before.arrow_forward
- Is it possible to not use peek()? Please help me with method that doesn't have peek()arrow_forwardWhat will be returned from the following method? public double testing ( ) { double a = 9.5 + 9.3; return a; } a) 18.8 b) 18.0 c) 18 d) 19arrow_forwardWrite a new method getBarChartString(String sign) which will draw a bar for this instance using the sign provided. For example, if the original getBarChartString() returns this value: Store 1: ******** The getBarChartString("+") will return: Store 1: ++++++++arrow_forward
- The following code is poorly structured. Rewrite it so that it has a better structure and avoids redundancy. To help eliminate redundancy, convert the code into a method named spending that accepts two parameters: a Scanner for the console, and a String for a single person's name, and prints the appropriate information about that person's bills. Your method could be called twice (once for John and once for Jane) to replicate the original code's behavior.arrow_forwardRearrange the code below to provide two additional CashRegister methods: an enterPayment method that reduces the total price by the given payment, and a giveChange method that returns the change due and resets the total price and item count. Not all lines are useful.arrow_forwardPlease help me! I have a lot of mini problems. I'm not sure how to start After #6, I have other problems. Those are : 7.) Write a method that reads a one-line sentence as input and then displays the following response: If the sentence ends with a question mark (?) and the input contains an even number of characters, display the word Yes. If the sentence ends with a question mark and the input contains an odd number of characters, display the word No. If the sentence ends with an exclamation point (!), display the word Wow. In all other cases, display the words You always say followed by the input string enclosed in quotes. Your output should all be on one line. Be sure to note that in the last case, your output must include quotation marks around the echoed input string. In all other cases, there are no quotes in the output. Your program does not have to check the input to see that the user has entered a legitimate sentence. Notes: This code requires a three-way selection statement and…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education