Java: Introduction to Problem Solving and Programming
Java: Introduction to Problem Solving and Programming
7th Edition
ISBN: 9780133834604
Author: SAVITCH
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 7, Problem 10PP

ELIZA was a program written in 1966 that parodied a psychotherapist session. The user typed sentences and the program used those words to compose a question.

Create a simple GUI application based on this idea. The program will use a label to hold the program’s question, a text field into which the user can type an answer, a button for the user to signal dial the answer is complete, and a quit button.

Graphics

The initial text for the question label should read: “What would you like to talk about?” When the user presses a button, get the text from the text field. Now extract the words from the text one at a time and find the largest wend of length 4 or more. Let’s call this largest word X for now. In response, create a question based on the length of the word. If the word is length 4, the new question is: “Tell me more about X.” If the word is length 5, the new question is: “Why do you think X is important?” If the word is length 6 or more, the new question is: “Now we are getting somewhere. How does X affect you the most?” If there is no word of length 4, the new question is: “Maybe we should move on. Is there something else you would like to talk about?” (Hint: You can use the class Scanner to extract the words from a string, assuming blanks separate the words. For example, the following statements

String text = “ one potato two potato ”;

Scanner parser = new Scanner (text);

System.out.println(parser.next());

System.out.println(parser.next());

display one and potato on separate lines.)

Blurred answer
Students have asked these similar questions
use java to Write a main application called yupi.java, and a GUI (that extends JFrame) called VowelGUI.java.The main program should open a file called “input.txt” which will contain a paragraph.Read the lines from the file until there are no more. For each line, count the number of individualvowels in that line, using a counter for the vowels ‘A’ and ‘a’, a counter for the vowels ‘E’ and ‘e’, and soforth.The GUI should have a grid layout of one row and two columns (column 0 and 1). Column 0 shouldcontain the original text from the file. Column 1 should contain 5 lines displaying the count of each ofthe vowels.the inputfile.txt can be any text inside.the yupi.java and VowelGui.java are files in 1 program
Design a GUI using Tkinter in python for sorting of five user defined integers, the specifications of GUI is as follows Set Window size of 300x250 All Labels are in column 0. All Entry text boxes are in column 1. Sort button is in column 1. Set Display text field of width 35 and height 6 with column span of 10. Display text field is in column 0.
This is in Python. Write a GUI program in which you ask the user to enter the number of miles driven in hour 1, the number of miles driven in hour 2, and the number of miles driven in hour 3. When you click the total button the output in the same GUI should say: the number of miles driven in the three hours is  190 miles (if hour 1 entry is 70, hour 2 entry is 72 and hour 3 entry is 48). There should be three labels, three entry boxes, and two buttons(total and quit)

Chapter 7 Solutions

Java: Introduction to Problem Solving and Programming

Ch. 7.2 - Give the definition of a static method called...Ch. 7.2 - Prob. 12STQCh. 7.2 - The following method compiles and executes but...Ch. 7.2 - Suppose that we add the following method to the...Ch. 7.3 - Prob. 15STQCh. 7.3 - Replace the last loop in Listing 7.8 with a loop...Ch. 7.3 - Suppose a is an array of values of type double....Ch. 7.3 - Suppose a is an array of values of type double...Ch. 7.3 - Prob. 19STQCh. 7.3 - Consider the partially filled array a from...Ch. 7.3 - Repeat the previous question, but this time assume...Ch. 7.3 - Write an accessor method getEntryArray for the...Ch. 7.4 - Prob. 23STQCh. 7.4 - Write the invocation of the method selectionSort...Ch. 7.4 - How would you need to change the method...Ch. 7.4 - How would you need to change the method...Ch. 7.4 - Consider an array b of int values in which a value...Ch. 7.5 - What output is produced by the following code?...Ch. 7.5 - Revise the method showTable in Listing 7.13 so...Ch. 7.5 - Write code that will fill the following array a...Ch. 7.5 - Write a void method called display such that the...Ch. 7.6 - Prob. 33STQCh. 7 - Write a program in a class NumberAboveAverage that...Ch. 7 - Write a program in a class CountFamiles that...Ch. 7 - Write a program in a class CountPoor that counts...Ch. 7 - Write a program in a class FlowerCounter that...Ch. 7 - Write a program in a class characterFrequency that...Ch. 7 - Create a class Ledger that will record the sales...Ch. 7 - Define the following methods for the class Ledger,...Ch. 7 - Write a static method isStrictlyIncreasing (double...Ch. 7 - Write a static method removeDuplicates(Character[]...Ch. 7 - Write a static method remove {int v, int [] in}...Ch. 7 - Suppose that we are selling boxes of candy for a...Ch. 7 - Create a class polynomial that is used to evaluate...Ch. 7 - Write a method beyond LastEntry (position) for the...Ch. 7 - Revise the class OneWayNoRepeatsList, as given in...Ch. 7 - Write a static method for selection sort that will...Ch. 7 - Overload the method selectionSort in Listing 7.10...Ch. 7 - Revise the method selectionSort that appears in...Ch. 7 - Prob. 18ECh. 7 - Write a sequential search of an array of integers,...Ch. 7 - Write a static method findFigure (picture,...Ch. 7 - Write a static method blur (double [] [] picture)...Ch. 7 - Write a program that reads integers, one per line,...Ch. 7 - The following code creates a small phone book. An...Ch. 7 - Write the method rotateRight that takes an array...Ch. 7 - The following code creates a ragged 2D array. The...Ch. 7 - Write a program that will read a line of text that...Ch. 7 - Prob. 2PPCh. 7 - Add a method bubbleSort to the class ArraySorter,...Ch. 7 - Add a method insertionSort to the class...Ch. 7 - The class TimeBook in Listing 7.14 is not really...Ch. 7 - Define a class called TicTacToe. An object of type...Ch. 7 - Repeat Programming Project 10 from Chapter 5 but...Ch. 7 - Prob. 8PPCh. 7 - Write a GUI application that displays a picture of...Ch. 7 - ELIZA was a program written in 1966 that parodied...Ch. 7 - Prob. 11PPCh. 7 - Create a GUI application that draws the following...Ch. 7 - Practice Program 2 used two arrays to implement a...Ch. 7 - Practice Program 5.4 asked you to define Trivia...
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Time Complexity Analysis - How To Calculate Running Time | InterviewBit; Author: InterviewBit;https://www.youtube.com/watch?v=--oxG4Q1PA0;License: Standard YouTube License, CC-BY