If the following code is inserted in line 57 in Listing 15.9, what is the output if the user presses the key for letter A? What is the output if the user presses the up arrow key?
circlePane.setOnKeyPressed(e →
System.out.println(“Key pressed ” + e.getCode()));
circlePane.setOnKeyTyped(e →
System.out.println(“Key typed ” + e.getCode()));
Want to see the full answer?
Check out a sample textbook solutionChapter 15 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version, Student Value Edition (11th Edition)
Additional Engineering Textbook Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Introduction To Programming Using Visual Basic (11th Edition)
Degarmo's Materials And Processes In Manufacturing
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
- I have the code for this one but I do seem to be missing something. This is the question - Modify the CountByFives application so that the user enters the value to count by. Start each new line after 10 values have been displayed. This is the code I have. I have got one check right but I can't get the other two - import java.util.*; public class CountByAnything { // Modify the code below public static void main (String args[]) { Scanner input = new Scanner(System.in); final int START; System.out.print("Please enter the value: "); START = input.nextInt(); final int STOP = 500; final int NUMBER_PER_LINE = 10; for(int i = START; i <= STOP; i += START) { System.out.print(i + " "); if(i % NUMBER_PER_LINE == 0) System.out.println(); } } }arrow_forwardPart 2 - OddOrEven ClassIn bluej. Write a program that prompts the user to enter an integer. The program should display “The input is odd" to the screen if the input is odd and displays “The input is even" to the screen if the input is even. Hint: Consider using the mod (%) operator.arrow_forwardImplement the OutputWithoutWhitespace() function. OutputWithoutWhitespace() outputs the string's characters except for whitespace (spaces, tabs). Note: A tab is '\t'. Call the OutputWithoutWhitespace() function in mainarrow_forward
- You are given a string. Get input from the user. In the first line, print the third character of this string. In the second line, print the second to last character of this string. In the third line, print the first five characters of this string. In the fourth line, print all but the last two characters of this string. In the fifth line, print all the characters of this string with even indices (remember indexing starts at 0, so the characters are displayed starting with the first). In the sixth line, print all the characters of this string with odd indices (i.e. starting with the second character in the string). In the seventh line, print all the characters of the string in reverse order. 8. In the eighth line, print every second character of the string in reverse order, starting from the last one. In the ninth line, print the length of the given string.arrow_forwardWrite a switch statement that checks origLetter. If 'a' or 'A', print "Alpha". If 'b' or 'B', print "Beta". For any other character, print "Unknown". Use fall-through as appropriate. End with newline. 1 import java.util.Scanner; 2 3 public class ConvertToGreek { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); char origLetter; 4 7 8 origLetter scnr.next().charAt(0); 9. 10 /* Your solution goes here */ 11 } 13 } 12arrow_forwardGiven string userString on one line, character charToFind on a second line, and integer strIndex on a third line, output "Found match" if the character at index strIndex of userString matches charToFind. Otherwise, output "No match". End with a newline. Ex: If the input is: warmth a 1 then the output is: Found match import java.util.Scanner; public class MatchingChar { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String userString; char charToFind; int strIndex; userString = scnr.nextLine(); charToFind = scnr.next().charAt(0); strIndex = scnr.nextInt(); /* Your code goes here */ } }arrow_forward
- Write an if-else statement to describe an object. Print "Balloon" if isBalloon is true and isRed is false. Print "Red balloon" if isBalloon and isRed are both true. Print "Not a balloon" otherwise. End with newline. (Notes) 439894.2564214.qx3zqy7 1 import java.util.Scanner; 2 3 public class RedBalloon { 4 5 6 7 8 9 10 11 12 13 14 15 } public static void main (String [] args) { Scanner scnr = new Scanner(System.in); boolean isRed; boolean isBalloon; } isRed = scnr.nextBoolean(); isBalloon scnr.nextBoolean(); /* Your solution goes here */arrow_forwardA. Which statement about regular expressions is correct? a. To find all occurrences of a matching substring for a regular expression, you must add thegflag. b. By default, pattern matching using regular expressions locates all matches in the searched string. c. To find all occurrences of a matching substring for a regular expression, you must add theiflag. d. The default behavior of a regular expression is modified by adding flags to the beginning of the expression. B. After the following JavaScript statements execute, the value ofcrayonsis["pink", "blue", "green"]. let crayons = ["pink", "purple"];crayons.shift();crayons.unshift("blue", "green"); Select one: True Falsearrow_forwardcan you please show me with the screen shot of the output, Thank you.arrow_forward
- 2-Fully explain the following code and draw all possible outputs. Please input a number between 5 and 10: Test Input function myFunction () { } var message, x; message = document.getElementById("p01"); message.innerHTML = ""; x = document.getElementById("demo").value; try { if (x == "") throw "empty"; if(isNaN(x)) throw "not a number"; x = Number (X); if (x 10) } } throw "too low"; catch(err) { message.innerHTML = "Input is " + err; throw "too high";arrow_forwardJavaarrow_forward1. Create a Java project named Answer 2. Define the class KEry based on the given descriptions. 3. Copy class KFryApps_Stage1.java into your project (from MS-Teams). 4. Run KFryApps_Stage1 program to get the given output. Problem Description: You need to construct a class KFry with all attributes as follows: 1. totalKErvOrder (int) 2. totalSales (double) 3. neQfSriekQrder(int) 4. neQfQriginalOrder(int) 5. neQfHonevQrder(int) 6. KoreanChicken(stack of String) Create the following methods for class KEry, It is COMPULSORY to implement the concept of stack data structure while performing each of these task. 1. Create a constructor that will set value 0.0 to attribute to totalSales and value 0 to attributes tetalKErvOrder, neQfSrickOrder, neOfOriginaOrder and noQfHonevOrder. 2. The addOrder) method will receive newKFrvOrder and update it into the KoreanChicken stack. This method will also update the value of three attributes; neQfSpicvQrder. neQfQriginalOrder, and noofHonevQrder. 3. The…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