1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
n200080 [17]
3 years ago
6

Java Eclipse homework. I need help coding this

Computers and Technology
1 answer:
kirill [66]3 years ago
6 0

import java.util.Scanner;

public class BaseConvertor {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Welcome to Base Convertor! This program will convert numbers into different bases of your choosing.");

       System.out.print("Do you still want to run the program? ");

       String ans = scan.next();

       if (ans.toLowerCase().equals("yes")){

           System.out.println("1. Octal");

           System.out.println("2. Binary");

           System.out.println("3. Hexadecimal");

           System.out.print("Type the number of the base you want to conver to: ");

           int base = scan.nextInt();

           System.out.print("Enter your number: ");

           int num = scan.nextInt();

           if (base == 1){

               

               String newNum = Integer.toOctalString(num);

               System.out.println(num+" in Octal is "+newNum);

           }

           else if (base == 2){

               String newNum = Integer.toBinaryString(num);

               System.out.println(num+" in Binary is "+newNum);

           }

           else if (base == 3){

               String newNum = Integer.toHexString(num);

               System.out.println(num+" in Hexadecimal is "+newNum);

           }

                   

       }

       else{

           System.out.println("Have a good day!");

       }

   }

   

}

I hope this helps!

You might be interested in
If the wrong server edition is installed, what command can be used to change to a different edition?​
nekit [7.7K]
Dism because it is used to change and service programs
6 0
3 years ago
QuickBooks Online (QBCU) Session 4: Post Assessme
Arada [10]

<em>Hence, I don't really know since I'm NOT 21 Years Old. If you're trying to record a credit/refund for a returned item, you'll have to enter a deposit, then link it to the vendor credit.  </em>

<em> </em>

<em>  </em>

<em> </em>

<em>First, you'll have to enter the refund as a deposit. Here's how: </em>

<em> </em>

<em>Click the Plus sign (+) icon. </em>

<em>Choose Bank Deposit. </em>

<em>Under Add funds to this deposit, choose the vendor name in the Received from field. </em>

<em>Choose Accounts Payable in the Accounts field, then enter the credit/refund amount in the Amount field. </em>

<em>Click Save and close. </em>

<em>Next, link the deposit to the vendor credit. Here's how: </em>

<em> </em>

<em>Click the Plus sign (+) icon. </em>

<em>Choose either Expense or Check. </em>

<em>Choose the vendor name. </em>

<em>On the right pane, under Add to Expense/Check, add the deposit by clicking Add. </em>

<em>Click Save and close. </em>

<em>Though, if you want to apply a vendor credit to a bill, check this article for the steps (Scenario 2): Manage vendor credits. </em>

<em> </em>

<em>  </em>

<em> </em>

<em></em>

3 0
3 years ago
Choose the correct statement:_______.
olga2289 [7]

Answer:

d. A String is a class data type so a String variable holds a reference to a location in memory

It depends on which programing language or scripting language...

Explanation:

If it's Java then D is the correct answer...

6 0
3 years ago
Derek has an interest in designing video games. What requirements should he fulfill to be a game designer?
dolphi86 [110]
Compooter science :D
3 0
3 years ago
A GPS is an example of a dedicated device true or false
Galina-37 [17]

Answer:

true

Explanation:

4 0
3 years ago
Other questions:
  • What output is produced by the following code fragment int num = 1 max = 20 while num &lt; max?
    7·1 answer
  • What file may contain data written to it in case of an unexpected error or program shut-down?
    12·2 answers
  • What is information reach? A. A global public network of computer networks that pass information from one to another using commo
    5·1 answer
  • If the pc-doctor software is installed on a computer's hard drive, what two different ways can the program be started?
    9·1 answer
  • Where would you look to see how much space is available on your c drive?
    8·1 answer
  • Cheryl has several concepts for mobile apps for smartphones. A friend suggests that she develop her apps for an open-source oper
    13·1 answer
  • A __________ acts as separate network that rests outside the secure network perimeter so untrusted users can access web servers
    10·1 answer
  • Which of the following plug-ins was developed by microsoft and is a software development tool used to write and run internet app
    10·1 answer
  • One way that Intuit handles the ________ of its TurboTax and other financial software is through its websites. The site includes
    11·2 answers
  • Which code segment results in "true" being returned if a number is even? Replace "MISSING CONDITION" with the correct code segme
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!