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 9271117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:32:22+00:00 2026-06-18T15:32:22+00:00

Ok, I am stumped here. I really looked into this and cant seem to

  • 0

Ok, I am stumped here. I really looked into this and cant seem to find specifically what I am trying to do. I am two weeks into Java in school and new to programming so please pardon any errors I may make.

I am working on a string manipulation program and among other tasks in it I am to create a sting called names that holds SunMonTueWedThuFriSat, now I need to figure out how to grab and display in JOptionPane the 3 characters in that string that go with the numbers I am supposed to associate with them (0=Sun, 1=Mon, etc.) So if the user inputs 2 it should display Tue. I have a basic understanding on how to display those characters in a string, but for the life of me i cant seem to figure out how to associate those numbers with those characters. Every time I try to work something I keep getting errors and frustration.

Thanks for all your help!!!

  • 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-18T15:32:23+00:00Added an answer on June 18, 2026 at 3:32 pm

    You should be able to just use substring, since all the abbreviations are three characters.

    String s = "SunMonTueWedThuFriSat";
    

    Prompt the user to enter a number (0-6):

    String in = JOptionPane.showInputDialog("Please input a number (0-6)");
    

    Now convert it to a number

    int choice = Integer.parseInt(in);
    

    And select the right portion of the string:

    String day = s.substring(choice*3, choice*3+3);
    

    Now just show this day in a JOptionPane:

    JOptionPane.showMessageDialog(null, "Information", "You chose: " + day, 
        JOptionPane.INFORMATION_MESSAGE));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm really stumped on this issue. I have a problem where Java can't find
This really has my stumped today. I'm sure its simple, but... Here is my
I'm new to javascript/jQuery this really has me stumped. What I'm trying to achieve
Ok, I'm a little stumped here, as I've never really dealt with anything this
I know this topic has been beaten into the ground, but I'm really stumped.
I'm really stumped trying to get the ParseKit.framework ( this ) to work in
This one has me stumped. Here are the relative bits of code: public AgencyDetails(Guid
This one really has me stumped. I have a documents table which hold info
Okay, this behavior has me really stumped. I have an IQueryable list that I'm
I'm totally stumped on this error. Would really appreciate some help :). To reproduce

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.