Question: please use Java Problem 1. Hexadecimal to decimal (HexaToDecimal.java) Description: in a decimal numbering system, we have 10 valid digits: 0-9. Every number can be
Problem 1. Hexadecimal to decimal (HexaToDecimal.java) Description: in a decimal numbering system, we have 10 valid digits: 0-9. Every number can be represented by a sequence of 0-9 digits, i.e. 512 In a binary numbering system, we have 2 valid digits: 0-1. Every number can be represented by a sequence of 0-1 digits, Le: 10111 In a hexadecimal numbering system, we have 16 valid digits: 0-9 and A- F. Every number can be represented by a sequence of these 16 digits, ie: 12CD, FFFF. Here A is corresponding to 10, B to 11, Cto 12, D to 13, E to 14 and F to 15. We can covert a hexadecimal number to a decimal number. For example, FFFF = 15*163 + 15*16*2 + 15*16*1 + 15*16*0 = 65535 Write a Java class named Hexa ToDecimal that prompts the user to enter a string representing a hexadecimal number. Convert this hexadecimal number to its corresponding decimal number, and print it out. You may assume that all inputs are valid. Outputs: s java HexaToDecimal Please enter a hexadecimal number: FFFF The corresponding decimal number is: 65535 Sjava HexaToDecimal Please enter a hexadecimal number: 00101 The corresponding decimal number is: 839937 Problem 2. Binary number for a decimal (DecimalToBinary.java) Ask the user to enter an integer within the range of [0, 255). Write a Java class that can convert the number to its corresponding binary number Make sure the resulting binary number has 8 bits. Outputs: Sjava DecimalToBinary Please enter an integer: 27 Its binary number is: 00011101
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
