//                                                  FLOWERBOX!!!!!!!
//                                                  YADADADADADA!
import java.util.Scanner;

public class BaseConversion
public static void main (String[] args)
//stores quotient of previous calculation and base
int quot;

//Defines scan and asks for base to convert to
Scanner scan = new Scanner (System.in);
System.out.println (“What base would you like to convert your base 10 number to (please choose a base under 10)?”);
int base = scan.nextInt();

//calculates the maximum convertable value containable within four digits
System.out.println (“The largest base 10 number you can convert to base “ + base + ” in four digits is “ + ((int)Math.pow(base , 4)- 1) + ” so please choose a base ten”“number between 0 and “ + ((int)Math.pow(base , 4)- 1) + “.”);

int num = scan.nextInt();
int val1 = num%base;
quot = num/base;
int val2 = ?;
quot = ?;
int val3 = ?;
quot = ?;
int val4 = ?;
System.out.println (“If you convert the base 10 number “ + num + ” to a base “ + base                                       + ” number, the answer is “ + val4 + val3 + val2 + val1);


The question marks were the parts that were taken out. Fill them in yourself. Also, don’t forget to rigorously test your program to make sure that you don’t have any logic errors. If you did something different from me for this program (or any of these programs, for that matter) and you want to ask me about it, as always, the comment section is open to you and so is the contact page.

Next Page is the Circle and Circle2 lab 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s