Java:
can also use “if else” statements
Write a program that can convert an integer between 0 and 15 into hex number (including 0 and 15). The user enters an integer from the console and the program displays the corresponding hex number. If the user enters an integer out of range, the program displays a warning message about the invalid input.
Table. Conversion between Decimal and Hexadecimal
| Decimal | Hexadecimal |
| 0 | 0 |
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
| 5 | 5 |
| 6 | 6 |
| 7 | 7 |
| 8 | 8 |
| 9 | 9 |
| 10 | A |
| 11 | B |
| 12 | C |
| 13 | D |
| 14 | E |
| 15 | F |
import java.util.Scanner;
public class Tester3 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Please Enter an Integer between 0 to 15 : ");
int input = sc.nextInt();
if(input >= 0 && input <= 15){
switch(input){
case 10 :
System.out.println(input+"----> A ");
break;
case 11:
System.out.println(input+"----> B ");
break;
case 12 :
System.out.println(input+"----> C ");
break;
case 13 :
System.out.println(input+"----> D ");
break;
case 14 :
System.out.println(input+"----> E ");
break;
case 15 :
System.out.println(input+"----> F ");
break;
default :
System.out.println(input+"----> "+input);
break;
}
}
else{
System.out.println("\nInvalid Input..please Try Again ");
System.out.println("Program Exiting.......");
}
}
}
Output:


Java: can also use “if else” statements Write a program that can convert an integer between...
Write a Java program to convert octal (integer) numbers into their decimal number equivalents (exactly the opposite of what you have done in Assignment 4). Make sure that you create a new Project and Java class file for this assignment. Your file should be named “Main.java”. You can read about octal-to-decimal number conversions on wikepedia Assignment 4 is at the bottom Objective Your program should prompt the user to enter a number of no greater than 8 digits. If the...
In C, write a program to convert a char (0-9) to Dec (ASCII
value). Then convert an ASCII Value to char
-------+ | ASCII CODE | + - ---+ +-- | char | Dec | ----+ | 'O' => 48 | | '1' => 49 | '2' => 50 | '3' => 51 | | '4' => 52 | | '5' => 53 | '6' => 54 | | '7' => 55 | | '8' => 56 | | '9'...
[Using Python] Write a program to convert a hexadecimal number to its decimal value. (Reminder: hexadecimal numbers are 0 through 9, A,B,C,D,E,F. hex(A) = 10, hex(F) = 15). example outputs: 1. `Enter a hex number: f` `The decimal value for hex number f is 15` 2. `Enter a hex number: g` `Incorrect hex number` 3. `Enter a hex number: 091c` `The decimal value for hex number 091c is 2332` 4. `Enter a hex number: 091g` `Incorrect hex number` Hints: you...
[Using Python] Write a program to convert a hexadecimal number to its decimal value using the ord builtin function (Reminder: hexadecimal numbers are 0 through 9, A,B,C,D,E,F. hex(A) = 10, hex(F) = 15). example outputs: 1. `Enter a hex number: f` `The decimal value for hex number f is 15` 2. `Enter a hex number: g` `Incorrect hex number` 3. `Enter a hex number: 091c` `The decimal value for hex number 091c is 2332` 4. `Enter a hex number: 091g`...
IN JAVA 1. Create a program that prompts the user for an integer and then displays a message indicating whether or not the number is a perfect square. This can be determined by finding the square root of a number, truncating it (by casting the double result), and then squaring that result 2. Write a program that prompts the user for two numbers. The first number is a minimum value and the second number is a maximum value. RandomNum then...
write programs with detailed instructions on how to
execute.
code is java
What you need to turn in: You will need to include an electronic copy of your report (standalone) and source code (zipped) of your programs. All programming files (source code) must be put in a zipped folder named "labl-name," where "name" is your last name. Submit the zipped folder on the assignment page in Canvas; submit the report separately (not inside the zipped folder) as a Microsoft Word...
Create a c++ program which: 1. Displays a menu: 1) Decimal to Binary • 2) Binary to Decimal • 3) Decimal to Hex • 4) Hex to Decimal • 9) Exit Program 2. For Menu item #1: Ask the user for a Decimal number. If they type a negative number, go back to step #1 1. Convert the Decimal number to binary and display it. 3. For Menu item #2: Ask the user for a binary number (1's and 0's)....
Description For this program, you are going to convert decimal (integer) numbers into their octal number (integer) equivalents. Make sure that you create a new Project and Java class file for this assignment. Your Repl.It file should be named “Main.java”. You can read about octal-to-decimal number conversions from wikepedia or another website Instructions The input to the program will be a single non-negative integer number. If the number is less than or equal to 2097151, convert the number to its...
Write a java program that asks the user to enter an integer. The program should then print all squares less than the number entered by the user. For example, if the user enters 120, the program should display 0, 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100.
VII JAVA ASSIGNMENT. Write a program with a graphical interface that allows the user to convert an amount of money between U.S. dollars (USD), euros (EUR), and British pounds (GBP). The user interface should have the following elements: a text box to enter the amount to be converted, two combo boxes to allow the user to select the currencies, a button to make the conversion, and a label to show the result. Display a warning if the user does not...