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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:13:03+00:00 2026-06-12T11:13:03+00:00

Here is the code: package classes; import java.util.*; public class Introduction { Scanner Input

  • 0

Here is the code:

package classes;
import java.util.*;

public class Introduction {
    Scanner Input = new Scanner(System.in);
    int classChoose;
    boolean repeat = false;

    public void Introduction() {
        System.out.println("\t===THE QUEST FOR PERSEPOLIS===\tv 1.0\n");
        System.out.println("Please choose a class: ");
        System.out.print("(1)Elite Knight\t");
        System.out.print("(2)Dawnguard\n");
        System.out.print("(3)Archer\t\t\t");
        System.out.print("(4)Barbarian\n");
        System.out.print("(5)Mage\t\t\t");
        System.out.print("(6)Swordsman\n");
        System.out.println("(7)Crossbowman\t");

        do {
            try {
                repeat = false;
                classChoose = Input.nextInt();
                while(classChoose < 1 || classChoose > 7) {
                    repeat = false;
                    System.out.println("Error. Enter a number between 1 and 7(inclusive).");
                    classChoose = Input.nextInt();
                }
            }
            catch(InputMismatchException e) {
                repeat = true;
                System.err.println("Caught: "+e);
                Input.nextLine();
            }
        }while(repeat = true);

        switch(classChoose) {
            case 1: chooseKnight();
                    break;
            case 2: chooseGuard();
                    break;
            case 3: chooseArcher();
                    break;
            case 4: chooseBarbarian();
                    break;
            case 5: chooseMage();
                    break;
            case 6: chooseSwordsman();
                    break;
            case 7: chooseCrossbowman();
                    break;
        }
    }
    public static void chooseKnight() {
        System.out.println("You have chosen the Elite Knight. You will be briefed and then you shall be set "
        +"on your quest!");
    }
    static void chooseGuard() {
        System.out.println("You have chosen the Dawnguard. You will be briefed and then you shall be set "
        +"on your quest!");
    }
    static void chooseArcher() {
        System.out.println("You have chosen the Archer. You will be briefed and then you shall be set "
        +"on your quest!");
    }
    static void chooseBarbarian() {
        System.out.println("You have chosen the Barbarian. You will be briefed and then you shall be set "
        +"on your quest!");
    }
    static void chooseMage() {
        System.out.println("You have chosen the Mage. You will be briefed and then you shall be set "
        +"on your quest!");
    }
    static void chooseSwordsman() {
        System.out.println("You have chosen the Swordsman. You will be briefed and then you shall be set "
        +"on your quest!");  
    }
    static void chooseCrossbowman() {
        System.out.println("You have chosen the Crossbowman. You will be briefed and then you shall be set "
        +"on your quest!");
    }
}

Everytime I run it, the program prompts me to choose my class. After I enter my choice, the program does not go on to the switch statement below the do loop. Can someone help me fix this?

-Calvin

  • 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-12T11:13:04+00:00Added an answer on June 12, 2026 at 11:13 am

    This is an assignment:

     while(repeat = true); // Note single '=', not '=='
    

    and the result of which will always be true, from section 15.26 Assignment Operators of the Java Language Specification:

    At run time, the result of the assignment expression is the value of the variable
    after the assignment has occurred.

    Change to:

    while(repeat);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the server code package echoserver; import java.net.*; import java.io.*; public class EchoServer
Here is my code.... package calendar; import java.util.*; /** * This class represents a
Here's my code package net.sourceforge.jwebunit.sample; import net.sourceforge.jwebunit.WebTestCase; public class JWebUnitSearchExample extends WebTestCase { public
I have the following code package myPackage; import org.neo4j.graphdb; import org.neo4j.kernel.EmbeddedGraphDatabase; public class dbServlet
Started making a game. Here's some of my code. package games.tribe.screens; import games.tribe.model.World; import
I didn't understand ..why I am facing this error.. Here is my code: package
I am trying to install MySQLdb package. I found the source code here .
We have a very complex Oracle package here (over 4,100 lines of code) that's
I'm using meteor with the bootstrap package. (here is a chunk of code where
I don't understand the meaning of the keyword static when I import System class:

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.