Jump to content
Banner by ~ Ice Princess Silky
  • entries
    53
  • comments
    84
  • views
    11,608

For people into coding *Help*


Vertigo_95

834 views

Can you please tell me what is wrong with this.

import javax.swing.JOptionpane;
class WordGame
{
public static void main(String[] args)
{
String Name;
Name = JOptionpane.showInputdialog ("What is your name.");
String Age;
Age = JOptionpane.showInputdialog ("what is your age.");
String City;
City = JOptionpane.showInputdialog ("Where do you live.");
String College;
College = JOptionpane.showInputdialog ("Where did you attend school.");
String Profession;
Profession = JOptionpane.showInputdialog ("Where do you work.");
String Animal;
Animal = JOptionpane.showInputdialog ("What type of pet do you have.");
String Petname;
Petname = JOptionpane.showInputdialog ("What is your pet name?");

 

String str="There once was a person named "+ Name +" who lived in "+ City +". At the age of "+ Age +" , "+ Name +" went to college at "+ College +". "+ Name +" graduated and went to work as a "+ Profession +". Then "+ Name +" adopted a(n) "+ Animal +" named "+ Petname +". They both lived happily ever after.";
JOptionpane.showmessageDialog(null, str);
}
}

 

 

It didn't come out the way I typed it in notepad, but whenever I try to compile it with Command Prompt, there is an error for every J in JOptionpane in each string, with the error message: Cannot find symbol. This is for my class, and it needs to be submitted by March 6th, so any help would be appreciated.

2 Comments


Recommended Comments

A few issues:

- "JOptionPane", not "JOptionpane"

- "showInputDialog", not "showInputdialog"

- "showMessageDialog", not "showmessageDialog"

 

Your code looks fine, it's just that a few functions, classes and imports aren't capitalised in the way Java wants it to be.

Link to comment

A few issues:

- "JOptionPane", not "JOptionpane"

- "showInputDialog", not "showInputdialog"

- "showMessageDialog", not "showmessageDialog"

 

Your code looks fine, it's just that a few functions, classes and imports aren't capitalised in the way Java wants it to be.

Thank you for the help. I compiled it, ran it, and it came out fine, except where it came out as one long line, which I simply edited with \n.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Join the herd!

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...