You must Sign In to post a response.
  • Category: Computers

    Program to display required items of a sentence


    Searching for program to display sentence related items? Find solutions to your query on this page.

    Write a program in java to accept any sentence and display all the palindromic words of the sentence and also display sum of those words whose sum of the ASCII value of the letters of the word is a prime number. A number is said to be prime number if it is divisible by 1 and the number itself.
    Can you provide the program?
  • #139835
    Please try this code in the java software.
    import java.awt.*;
    import java.awt.image.*;
    import java.io.*;
    import javax.imageio.*;
    import javax.swing.*;

    /**
    * * @author .....
    */
    public class .....
    public static void main(String[] args) throws Exception
    {
    new ImageDemo(args[0]);
    }

    public ImageDemo(final String filename) throws Exception
    {
    SwingUtilities.invokeLater(new Runnable()
    {
    public void run()
    {
    JFrame editorFrame = new JFrame("Image Demo");
    editorFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    BufferedImage image = null;
    try
    {
    image = ImageIO.read(new File(filename));
    }
    catch (Exception e)
    {
    e.printStackTrace();
    System.exit(1);
    }
    ImageIcon imageIcon = new ImageIcon(image);
    JLabel jLabel = new JLabel();
    jLabel.setIcon(imageIcon);
    editorFrame.getContentPane().add(jLabel, BorderLayout.CENTER);

    editorFrame.pack();
    editorFrame.setLocationRelativeTo(null);
    editorFrame.setVisible(true);
    }
    });
    }
    }

    Saket singh
    Everyday Learner

  • #141908
    Here is an example. */ publicclassGeneratePrimeNumbersExample{ publicstaticvoidmain(String[]args){ //define limit intlimit=100; System.out.println("Prime numbers between 1 and "+limit); //loop through the numbers one by one for(inti=1;i<100;i++){ booleanisPrime=true; //check to see if the number is prime for(intj=2;j
    Be the Hero of the zero hour!

  • #141909
    TThis response is marked as DELETED by the admin.

    Here is an example. */ publicclassGeneratePrimeNumbersExample{ publicstaticvoidmain(String[]args){ //define limit intlimit=100; System.out.println("Prime numbers between 1 and "+limit); //loop through the numbers one by one for(inti=1;i<100;i++){ booleanisPrime=true; //check to see if the number is prime for(intj=2;j
    Be the Hero of the zero hour!


  • Sign In to post your comments