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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:46:05+00:00 2026-06-13T19:46:05+00:00

This is my last lab of this set for while/do-while loops and I’ve got

  • 0

This is my last lab of this set for while/do-while loops and I’ve got it all figured out aside from my result printing out in the exact reverse of what it should be.

public class TenToAny
{
private int base10;
private int newBase;

public TenToAny()
{

}

public TenToAny(int ten, int base)
{
   base10 = ten;
   newBase = base;
}

public void setNums(int ten, int base)
{
   base10 = ten;
   newBase = base;
}
public String getNewNum()
{
    String newNum="";
    int orig = base10;

    while(orig > 0)
    {
        newNum = orig%newBase + newNum;
        orig = orig/newBase;
    }
    return newNum;
}

public String toString()
{
    String complete = base10 + " base 10 is " + getNewNum() + " in base " + newBase;

    return complete;
}


}

here’s what my results should be:

234 base 10 is 280 in base 9

100 base 10 is 1100100 in base 2

these are the expect results for the first two values (234 in base 9 AND 100 in binary)

Here’s what I’m getting:

234 base 10 is 082 in base 9

100 base 10 is 0010011 in base 2

  • 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-13T19:46:06+00:00Added an answer on June 13, 2026 at 7:46 pm

    You’re simply adding the end of the newNum instead of prepending.

    newNum = newNum + orig%newBase;
    

    … should be …

    newNum = orig%newBase + newNum;
    

    For characters…

    When orig%newBase > 9, then char(55 + orig%newBase)

    var nextValue = orig % newBase;
    
    if (nextValue > 9)
    {
        newNum = char(55 + nextValue) + newNum;
    }
    else
    {
        newNum = nextValue + newNum;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need this query - update last but one record. UPDATE changes SET checked=''
We are an all Unix shop (Solaris, Linux). This last product cycle I returned
I really need help with this last part of my program. I need to
I came across this issue last night where my CSS would not affect the
what is the logic behind this on this website last activity: 1 min ago
I want to have on my page something like This page last refreshed on:
So, thought I had this working last night, couldve sworn it. Now it no
Possible Duplicate: Problem with database in CodeIgniter Alright, I've googled this the last two
This was working last night, but I must have accidentally changed something, because it
This is the last part of the program I am working on. I want

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.