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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:44:58+00:00 2026-05-22T15:44:58+00:00

I have made an object named Skill and the main program. Skill : import

  • 0

I have made an object named “Skill” and the main program.
Skill:

    import java.util.*;
class Skill
{
    static Scanner reader = new Scanner(System.in);
    public int iStar;
    public int iColor; //0-White, 1-Red, 2-Orange, 3-Grenn, 4-DeepSkyBlue, 5-Blue.
    public String sName;
    public String sText;
    public String sLink;
    public String sRank;
    Skill()
    {
        System.out.println ( "What is the skill name?" );
        this.sName = reader.nextLine();
        System.out.println ( "Insert the icon's link please" );
        this.sLink = reader.nextLine();
        System.out.println ( "Which rank is recommended to this skill?" );
        this.sRank = reader.nextLine();
        System.out.println ( "Explanation about the skill" );
        this.sText = reader.nextLine();
        System.out.println ( "Text color?" + "\n" + "1-Red, 2-Orange, 3-Green, 4-DeepSkyBlue, 5-Blue." );
        this.iColor = reader.nextInt();
        System.out.println ( "How many stars would you like? (0-2)" );
        this.iStar = reader.nextInt();
    }
    void FixMe (  )
    {
        int iNum = 0;
        System.out.println ( "Which one of the data would you like to change?" + "\n" + "0-non of them, 1-Star, 2-Color, 3-Name, 4-Text, 5-Link, 6-Rank." );
        do
        {
            switch ( reader.nextInt() )
            {
                case 0: iNum = 0;
                                break;
                case 1: this.iStar = reader.nextInt();
                               iNum = 0;
                                break;
                case 2: this.iColor = reader.nextInt();
                               iNum = 0;
                                break;
                case 3: this.sName = reader.nextLine();
                               iNum = 0;
                                break;
                case 4: this.sText = reader.nextLine();
                               iNum = 0;
                                break;
                case 5: this.sLink = reader.nextLine();
                                iNum = 0;
                                break;
                case 6: this.sRank = reader.nextLine();
                               iNum = 0;
                                break;
                default: System.out.println ( "Error, Please insert again the number of the data (!) ." );
                                    iNum = 1;
                                    break;
            }
        }
        while ( iNum == 1 );
    }
    String ImageIt (  )
    {
        String sPro = "[IMG]" + this.sLink + "[/IMG]";
        return sPro;
    }
    String BoldIt (  )
    {
        String sPro = "[B]Rank " + this.sRank + "[/B]";
        return sPro;
    }
    String UnderscoreIt (  )
    {
        String sPro = "[U]" + this.sName + "[/U]";
        return sPro;
    }
    String ColorIt ( String sNoob )
    {
        String sPro = "[COLOR=\"";
        int iNum = 0;
        do
        {
            switch ( this.iColor )
            {
                case 1: sPro+= "Red";
                                iNum = 0;
                                break;
                case 2: sPro+= "Orange";
                                iNum = 0;
                                break;
                case 3: sPro+= "Green";
                                iNum = 0;
                                break;
                case 4: sPro+= "DeepSkyBlue";
                                iNum = 0;
                                break;
                case 5: sPro+= "Blue";
                                iNum = 0;
                                break;
                default: System.out.println ( "Error, Please insert again the number of the color (!) ." );
                                    this.iColor = reader.nextInt();
                                    iNum = 1;
                                    break;
            }
        }
        while ( iNum == 1 );
        sPro+= "\"]" + sNoob + "[/COLOR]";
        return sPro;
    }
    String WhiteColorIt ( int FirstOrSecond )
    {
        String sPro = "[COLOR=\"White\"]";
        if ( FirstOrSecond == 1 )
        {
            int iNum = 0;
            do
            {
                if ( this.iStar >= 3 || this.iStar < 0 )
                {
                    System.out.println ( "Error, Please insert again the number of the stars (!) ." );
                    this.iStar = reader.nextInt();
                    iNum = 1;
                }
                else
                {
                    iNum = 0;
                }
            }
            while ( iNum == 1 );
            iNum = 2 - this.iStar;
            for ( ; iNum != 0; iNum-- )
                sPro+= "*";
            sPro+= "[/COLOR]";
        }
        else
            sPro+= "**[/COLOR]";
        return sPro;
    }
    /*הפעולה הראשית*/
    String ExtractMe()
    {
        String sPro = "";
        String sTemp = "";
        switch ( this.iStar )
        {
            case 0: sPro+= this.WhiteColorIt ( 2 ) + " ";
                           sTemp = this.ImageIt() + " " + this.UnderscoreIt();
                           sTemp = this.ColorIt ( sTemp );
                           sPro+= sTemp;
                           break;
            case 1: sPro+= this.WhiteColorIt ( 1 );
                           sTemp = "* " + this.ImageIt() + " " + this.UnderscoreIt();
                           sTemp = this.ColorIt ( sTemp );
                           sPro+= sTemp;
                           break;
            case 2: sPro+= "** " + this.ImageIt() + " " + this.UnderscoreIt();
                           sPro = this.ColorIt ( sPro );
                           break;
            default:
                                break;
        }
        sPro+= " - " + this.sText + "\n";
        sPro+= this.WhiteColorIt ( 2 ) + " " + this.BoldIt() + ".";
        return sPro;
    }
}

Main:

    import java.util.*;
public class Main
{
    static Scanner reader = new Scanner(System.in);
    public static void main(String[] args)
    {
        String sPro = "";
        Skill Winner01 = new Skill();
       System.out.println ( "האם אתה רוצה לתקן את אחד הנתונים?" + "\n" + "1-Yes, 2-No");
       if ( reader.nextInt() == 1 )
                Winner01.FixMe();
       sPro+= Winner01.ExtractMe() + "\n";
       Skill Winner02 = new Skill();
       System.out.println ( "האם אתה רוצה לתקן את אחד הנתונים?" + "\n" + "1-Yes, 2-No");
       if ( reader.nextInt() == 1 )
                Winner02.FixMe();
       sPro+= Winner02.ExtractMe() + "\n";
        System.out.println ( sPro );
    }
}

I am using BlueJ, and while i tried to test the program i made 2 Skills. so I used twice the “Skill()”, but in the second time the reader.nextLine() didn’t work.

  • 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-05-22T15:44:59+00:00Added an answer on May 22, 2026 at 3:44 pm

    You are creating two instances of the scanner class, both attached to System.in. One is situated in you Main class, the other one in the Skill class. Those two interfere when they try to read from the same inputstream.

    A possible solution is to instantiate only one scanner and pass it as argument to the constructor of your Skill class.

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

Sidebar

Related Questions

I have a collection of an object called Bookmarks which is made up of
I have made a program in c and wanted to see, how much memory
I have made a new windows service which works fine using barebone code (just
I have a JavaScript class that I have made and put it into its
I have made a SVG image, or more like mini application, for viewing graphs
I have made some code which exports some details of a journal article to
I have made a custom UserControl i Vb.net (windows application). How can I add
I have made a little app for signing up for an event. User input
So I have made a webservice that interfaces with a set of data contained
Background I have made a Web Service in Visual Studio, and I'm trying to

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.