Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8905621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:26:28+00:00 2026-06-15T02:26:28+00:00

this code is supposed to receive a full name string example Billy Bob Smith

  • 0

this code is supposed to receive a full name string example “Billy Bob Smith” in an input dialog box and output the initials as a monogram example “BBS” in a message dialog box. but for some reason the main method won’t let me acces the fullName variable.

import javax.swing.*;

public class HardMonogram {
     //---------- ATTRIBUTES ----------//
     private String fullName;
     private String monogram;
     private String first;
     private String middle;
     private String last;


     //---------- METHODS ----------//
     public String getInitial(String seperateName) {
           return seperateName.substring(0, 1);
     }

     public void getSeperateName(String fullName) {
           first  = fullName.substring(0, fullName.indexOf(" "));
           middle = fullName.substring(fullName.indexOf(" ") + 1, fullName.length());
           last   = middle.substring(middle.indexOf(" ") + 1, middle.length());
           middle = middle.substring(0, middle.indexOf(" "));
     }

    public void setMonogram() {
          monogram = getInitial(first)  +
                     getInitial(middle) +
                     getInitial(last);

    JOptionPane.showMessageDialog(null, monogram);
    }

    public static void main(String[] args) {
           myMono.fullName = JOptionPane.showInputDialog(null, "Type in you full name");

           HardMonogram myMono = new HardMonogram();
           myMono.getSeperateName(myMono.fullName);
           myMono.setMonogram();

    }


}

gives me this build error

/Users/aaron/School/Fall 2012/CSCI-C 201/Labs/LB08/HardMonogram.java:33: error: cannot find symbol
    myMono.fullName = JOptionPane.showInputDialog(null, "Type in you full name");
    ^
symbol:   variable myMono
location: class HardMonogram
1 error
[Finished in 1.2s with exit code 1]

it’s for my intro to java class but I don’t know why I can’t acces the variable. I’m obviously overlooking something. any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:26:29+00:00Added an answer on June 15, 2026 at 2:26 am

    Simply put myMono.fullName = JOptionPane.showInputDialog(null, "Type in you full name"); after object declaration (HardMonogram myMono = new HardMonogram();).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code is supposed to be able to sort the items in self.array based
This code is supposed to read postfix problems from a file and and write
This piece of code is supposed to go through a list and preform some
i have this code in php and it's supposed to print me the image
I've created this code, it is supposed to use wordpress metabox functionality to save
I've had trouble writing this code. I'm supposed to make a function that can
I wrote this piece of code that is supposed to redirect something written on
this is part of my code which reads an http response. It's supposed to
I have this piece of coding which is supposed to receive a URL as
The following code is supposed to return current item name typedef enum ItemName {test1,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.