Concept explainers
ELIZA was a
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.)
Want to see the full answer?
Check out a sample textbook solutionChapter 7 Solutions
Java: An Introduction to Problem Solving and Programming (7th Edition)
- 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.arrow_forwardJAVA Create a GUI application where the user enters the whole cost of an item and its markup percentage into text fields. (for example, if an item's wholesale cost is $5 and its markup percentage is 100%, then its retail price is $10.) The application should have a button that displays the item's retail price when clicked.Example of it running in the image providedarrow_forwardGUI calculator in python - The user enters two integers into the text fields. - When the Add button is pressed, the sum of values in the text fields are shown after the Equals: as a label. - The Clear button clears the values in the text fields and the result of the previous calculation. The cleared values can be blank or zero. - The Quit button closes the GUI window.arrow_forward
- java creates an application that initially displays a yellow circle. add three radio buttons labeled "yellow", "pink" and "black" and three regular buttons labeled "Arc", "Square" and "Circle". The shape and the color displayed in the drawing panel should reflect the choice from the radio buttons and the regular buttons. if the user chooses "pink" and "circle", the app should display a pink circle. java GUIarrow_forwardDice Simulator Create an application that simulates rolling a pair of dice. When the user clicks a button, the application should generate two random numbers, each in the range of 1 through 6, to represent the value of the dice. Use PictureBox controls to display the dice. (In the Student Sample Programs, in the Chap05 folder, you will find six images named Die1.bmp, Die2.bmp, Die3.bmp, Die4.bmp, Die5.bmp, and Die6.bmp that you can use in the PictureBoxes.)arrow_forwardA software company sells a package that retails for $99. Quantity discounts are given according to the following table: Quantity Discount 10-19 10% 20-49 20% 50-99 30% 100 or more 40% Write a GUI program that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount. A successful test run of the program for different inputs is as shown below:arrow_forward
- A county collects property taxes on the assessment value of property, which is 60 percent of the property’s actual value. If an acre of land is valued at $10,000, its assessment value is $6,000. The property tax is then $0.64 for each $100 of the assessment value. The tax for the acre assessed at $6,000 will be $38.40. In Python, design a GUI program that displays the assessment value and property tax when a user enters the actual value of a property. Use a class to implement the GUI window display and functionality.arrow_forwardi need the answer quicklyarrow_forwardProgramming Exercise #2: Grade Create an application that calculates and displays the percentage of students receiving a grade of P (for Passed) and the percentage of students receiving a grade of F (for Failed). Before creating your Planning Chart, consider what information the user will need to enter (if Grade >= 75, PASSED, FAILED). a. Prepare a Planning Chart for the application. b. Draw a sketch of an appropriate interface. Be sure to follow the GUI design guidelines covered in the chapter. The guidelines are summarized in Figure 2-20 (found on page 66). (If you want to include an image in the interface, you can either use your own image file or download an image file from openclipart.org. When downloading from openclipart.org, be sure to use the SMALL IMAGE (.PNG) button.) c. Create a Windows Forms application. Use the following names for the project and solution, respectively: FamilyName_Grade Project and FamiltyName_Grade Solution. Save the application in the…arrow_forward
- C# Language: Create a Windows application using Visual Studio. Create a simple word-guessing game using ArrayList and StringBuilder. Must have GUI. Create a short description of the game created and explain How it plays.arrow_forwardFor each of the following exercises, you may choose to write a console-based or GUI application, or both. Write a program for The Carefree Resort named ResortPrices that prompts the user to enter the number of days for a resort stay. Then display the price per night and the total price. Nightly rates are $200 for one or two nights; $180 for three or four nights; $160 for five, six, or seven nights; and $145 for eight nights or more.arrow_forwardCreate an enumeration named Month that holds values for the months of the year, starting with JANUARY equal to 1. (Recall that an enumeration must be placed within a class but outside of any method.) Write a GUI program named MonthNamesGUl that prompts the user for a month integer. Convert the users entry to a Month value, and display it.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,