When the user presses a button

Assignment Help JAVA Programming
Reference no: EM13161017

Part A-Text messaging is a popular means of communications. Many abbreviations are in common use but are not appropriate for formal communications. Suppose the abbreviations are stored, one to a line, in a text file names abbreviation.txt. For example, the file might contain these lines:

lol

:)

iirc

4

u

ttfn

Write a program that will read a message from another text file and surround each occurrence of an abbreviation with <> brackets. Write the marked message to a new text file.

For example, if the message to be scanned is

How are u today? Iirc? This is your first free day. Hope you are having fun! :)

The new text file should contain

How are <u> today? <Iirc>, this is your first free day. Hope you are having fun! <:)>

Part B- Write an application or applet that implements a simple text editor. Use a text field and a button to get the file. Read the entire file as characters and display it in the JTextArea. The user will then be able to make changes in the text area. Use a Save button to get the contents of the text area and write that over the original file. Create an Exit button to exit the application.

Technical Details: Read each line from the file and then display the line in the text area using the method append (aString). The method getText will return all of the text in the text area in a string that then can be written to the file. The following statement will make the text referenced by editorTextArea scrollable:

JScrollPane scrollPane = new JScrollPane(editorTextArea);

Then add scrollPane to your GUI, just as you would add any other component. The text area editorTextArea does not need to be added to the GUI, but it can be used.

Part C - 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 applet or GUI application based on this idea. The program will use a label to hold the program's question, a text field into which the use can type an answer, a button for the use to signal that the answer is complete, and a quit button.

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 text field. Now extract the words from the text one at a time and find the largest word 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 length 5, the new questions: "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 a separate lines).

Reference no: EM13161017

Questions Cloud

Function whose job is to output some sequence : Write a function whose job is to output some sequence of "interesting" #'s. The numbers should be separated from one another somehow so they don't all run together. This function may need to call another function, where the second function determines..
What is the probability : Suppose that the probability than an incoming email is a spam is p(S), that the probability that the word "w" occurs in the subject line of the spam is p(w), and that q(w) is the probability that the word "w" occurs in the subject line of an email th..
Function whose job is to input : Write a function whose job is to input #'s, non-# to quit, recover from the input failure by calling recover(), and tell main some statistics about the numbers read. A. unsigned readA();
The user enter the total rainfall for each of 12 months : Write a program that lets the user enter the total rainfall for each of 12 months (starting with January) into an array of doubles. The program should calculate and display:the total rainfall for the year,the average monthly rainfall,and the months w..
When the user presses a button : When the user presses a button, get the text from text field. Now extract the words from the text one at a time and find the largest word of length 4 or more. Let's call this largest word X for now. In response, create a question based on the length ..
Write a program that takes a positive integer : Write a program that takes a positive integer from the user and prints the rightmost digit of that integer. This is a sample output: Enter an integer: 1247
Desktop publishing system : Consider a desktop publishing system used to produce documents for various organizations. a. Give an example of a type of publication for which confidentiality of the stored data is the most important requirement
Write a program to find that number for nguyen. : In some Asian countries, 8 and 6 are considered lucky digits. Any number containing only 8s and 6s is considered lucky number, e.g. 6, 8, 66, 668, 88, 886 .... Nguyen is a student who likes mathematics very much. Nguyen likes lucky numbers but only o..
Register address machine : Express the statement X= (A*B)-(C*D)-E in the assembly language of each of 0- memory address machine, 3-register address machine with 3 registers R1,R2,R3, and 2-memory-register-address machine with three registers R1,R2, R3. Your solution should use..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Wrappershallow and wrapperdeep

Each class is simply a wrapper class to hold a private array variable. int [] a; The default constructor for each class should initialize â??aâ??. Each class should have a toString() and equals(). Each class should have a setArray method that allows ..

  A java program that will prompt the user to input a file

Write a Java program that will prompt the user to input a file (document) in order to count the frequency of each word. This program will display the frequency of each word sorted alphabetically or by frequency (depending on the preference of the use..

  Compute area and perimeter of a polygon

Create a project that would let a user compute area and perimeter of a polygon

  Recognize one high severity vulnerability for computer

Recognize one high severity vulnerability for each computer (if there is one). Explain vulnerability and describe control(s) to minimize risk from vulnerability.

  Write an application that extends jframe

Write an application that extends JFrame and that displays a phrase in every font size from 6 through 20.

  How to access to elements of document object model

To limit creation of malicious code, do you believe that access to elements of document object model and some Javascript functionality be limited?

  Determine the decision of java

Determine the decision of Java as the platform to develop this program. Identify the Java-based technologies utilized in this project and analyze each of them. Then, provide discussion on the purpose of each of the Java-based technologies utiliz..

  World data app

Prepare WorldDataApp project. It implements the NameIndex portion, including creating it in SetupProgram, and searching, viewing and updating it in UserApp program.

  Client server monitoring system project design

client server monitoring system project design. The server adminstation can send messages to the clients and DESIGN WITH JAVA NETBEANS AND GUI.

  Java program to find a value at in index

Construct a main class named Array Program that generates an array of 50-integers, all ranging from one to one hundred.

  Develop a graphical user interface based java program

Develop a Java program that can communicate with a real SMTP email server for sending emails. TNE 60003 - introduction to network programming, You program should provide a GUI and can successfully send the SMTP commands to the mail server

  Public float usefulload()

public float usefulLoad() // this is the grossWeight - emptyWeight public float usefulLoadWithFuel( in gallons ) // this is the useful load - gallons x 6. The programmer user will pass in the number of gallons on board.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd