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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:16:39+00:00 2026-06-12T16:16:39+00:00

Whenever I try to scale the shape, nothing happens and then the console stops

  • 0

Whenever I try to scale the shape, nothing happens and then the console stops responding to input.
Here is the set scale command:

case 7: do
                         {
                            System.out.println("\nEnter scale factor");
                            scale=input.nextDouble();
                         }
                         while(scale<0);
                         Shape.setScaleFactor(scale);
                         break;

Here is the scale shape command

 case 4: for(i=0; i<s.length; i++)
                         {
                            if(s[i]!=null)
                            {
                              s[i].scaleShape();
                            }
                         }
                         break;

Here is the main method variables:

int i=0;
        int m=0;
        double scale;
        boolean exit=false;
        Shape[] s = new Shape[10];

Here are all the relevant methods in the shape class;

private static double scaleFactor;
public static double getScaleFactor()
    {

        return scaleFactor;
    }
    //Set ScaleFactor
    public static void setScaleFactor(double x)
    {

        scaleFactor=x;
    }

Here is the scaleshape method in the rectangle subclass

private double base;
    private double height;   
@Override public void scaleShape()
    {
        base=base*getScaleFactor(); height=height*getScaleFactor();

    }

        public abstract void scaleShape();

Here is the set scale method in the circle class:

private final double pi = Math.PI;
    private double radius;
 @Override public void scaleShape()
    {
         radius*=getScaleFactor();
    }
  • 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-12T16:16:40+00:00Added an answer on June 12, 2026 at 4:16 pm

    My guess is that your problem is here:

    do
    {
        System.out.println("\nEnter scale factor");
        scale = input.nextDouble();
    }
    while(scale < 0);
    

    What happens if you add some logging?

    do
    {
        System.out.println("\nEnter scale factor");
        scale = input.nextDouble();
        System.out.println("Scale entered was: " + scale);
        System.out.println("Is scale < 0? " + (scale < 0));
    }
    while(scale < 0);
    

    If you don’t get what you’re expecting, it might be worthwhile to read in a String instead just to see what input you’re actually getting. You can always read a String, log it, then use Double.valueOf(String) to convert it.

    Another possibility is that it’s working, but you never reset scale and this is in some sort of loop, so it just continues scaling the shape forever but never stops to ask for input again.

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

Sidebar

Related Questions

Whenever I try to use the Rails script/generate or script/install command I get this
Whenever I try uploading to a device from MonoTouch, I get the following console
Whenever I try to print the char arrays to the console, I'm getting the
Whenever I try to launch Android SDK, a cmd window just flashes and nothing
Whenever I try installing anything using gem, I get this error - murtaza@murtaza-dev:~$ sudo
Whenever I try to edit existing or create new distribution provisioning profile on iOS
Whenever I try to use ranges in D, I fail miserably. What is the
Whenever I try to extend the Object prototype, I get an error: Error #1056:
Whenever I try to use apt-get/dpkg, it tries a to install a broken source.
Whenever i try to run sqlmetal, i get this: 'sqlmetal' is not recognized as

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.