1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
BlackZzzverrR [31]
4 years ago
11

Design and code a Swing GUI to translate text that is input in english into pig latin. You can assume that the sentence contains

no punctuation. the rules for pig latin are as follows : for words that begin with consonants, move the leading consonant to the end of the word and add "ay" thus "ball" becomes "allbay" for words that begin with vowels add "way" to the end of the word thus "all" becomes "allway" use a flow layout with a jtextarea for the source text and a seperate jtextarea for the translated text add a jbutton with an event to perform the translation.
Computers and Technology
1 answer:
Whitepunk [10]4 years ago
5 0

Answer:

Code given below

Explanation:

import javax.swing.*;

import java.util.*;

import java.awt.*;

import java.awt.event.*;

public class PigLatin extends JFrame

{

private JLabel prompt;

private JTextField input;

private JTextArea output;

private int count;

public PigLatin()

{

super( "Pig Latin Generator" );

prompt = new JLabel( "Enter English phrase:" );

input = new JTextField( 30 );

input.addActionListener(

new ActionListener() {

public void actionPerformed( ActionEvent e )

{

String s = e.getActionCommand().toString();

StringTokenizer tokens = new StringTokenizer( s );

count = tokens.countTokens();

while ( tokens.hasMoreTokens() ) {

count--;

printLatinWord( tokens.nextToken() );

}

}

}

);

output = new JTextArea( 10, 30 );

output.setEditable( false );

Container c = getContentPane();

c.setLayout( new FlowLayout() );

c.add( prompt );

c.add( input );

c.add( output );

setSize( 500, 150 );

show();

}

private void printLatinWord( String token )

{

char letters[] = token.toCharArray();

StringBuffer schweinLatein = new StringBuffer();

schweinLatein.append( letters, 1, letters.length - 1 ) ;

schweinLatein.append( Character.toLowerCase( letters[ 0 ] ) );

schweinLatein.append( "ay" );

output.append( schweinLatein.toString() + " " );

if ( count == 0 )

output.append( "\n" );

}

public static void main( String args[] )

{

PigLatin app = new PigLatin();

app.addWindowListener(

new WindowAdapter() {

public void windowClosing( WindowEvent e )

{

System.exit( 0 );

}

}

);

}

}

You might be interested in
Juan is a network administrator and must set up a VPN for his company's network. To allow safe communication, he should
Mekhanik [1.2K]

Answer:

select Control Panel, then Network Protocols, then Internet

4 0
3 years ago
Given the string variable address, write an expression that returns the position of the first occurrence of the string avenue in
Delicious77 [7]
It depends on a language you code. I think this could be either C++ or Java. I know answer for both of them.
For C++:  <span>address.find("Avenue")
For Java: </span><span>address.indexOf("Avenue")</span>
4 0
3 years ago
This has nothing to do with anything school related, but I'm new to car audio and I was wondering, what happens or what would ha
DerKrebs [107]
It most likely can but It may damage your system. So you should seek out professional help from a car dealership and do more research.

Hope this helps.<span />
7 0
3 years ago
"________ are used to edit videos to enhance quality and appearance."
AveGali [126]
Video editors are used to edit videos making them more visually pleasing in quality and appearance. They are very popular nowadays when people are fond of taking videos and uploading them to social networking sites. Examples are Adobe Premier PRo, Sony Vegas Movie studio and Lightworks.
5 0
4 years ago
DEF is a small consulting firm with ten on-site employees and 10 to 12 part-time (off-site) software consultants. Currently, the
kherson [118]

Answer:

What i would suggest for the organization is to use the Testing Infrastructure strategy. it is good for your consulting firm because it is less costly and provide security.

Explanation:

Solution

There are different network security strategy which is listed below:

Segment the network:

Segmentation in network is very useful for providing security.If any threat is occur only one segment is effected remaining are safe and it is less cost process. very useful for small organizations.

Test your infrastructure :

Testing infrastructure also very good technique.

Always we have to test our infrastructure whether threat is occur or not.

If any threat is happen we can detect that easily by testing our infrastructure.

Regularly update anti-virus software :

This is very useful for small organizations and it is less cost.with less cost we can provide security for all devices like computer,server,modems etc.

Frequently backup your critical data :

This is very good technique for crucial data.If we backup important data any time that will be useful if any attack is happen.

This is less costs and simple.

Change router default security settings :

Changing router password and settings also helpful for providing security.If we maintain same password and same settings for a long time that may lead to data hacking.It is cost less process very useful for small organizations.

6 0
3 years ago
Other questions:
  • What can help you best learn about appearance, habitats and behaviors of birds in your area
    9·1 answer
  • How do you spell kiss in Japanese
    13·2 answers
  • A statement describing both the requirements that must be met by a product or process amd the ways in which satisfaction of the
    8·2 answers
  • What is the order in which windows systems receiving and process multiple gpos?
    7·1 answer
  • To what are multiple servers arranged in racks related
    14·2 answers
  • Write java code that displays all the objects in a stack in the order in which they were pushed onto it. after all the objects a
    5·1 answer
  • "Which of the following is not an example of a project? Select one: a. Creating a website for a company b. Raising money for a d
    5·1 answer
  • What is the technological singularity and what are the dangers it brings to man
    12·1 answer
  • Define CPU and its functions​
    7·2 answers
  • which two partitions do you typically create at minimum during a fedora linux installation? (choose two answers.)
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!