Hi everyone,
I'm pretty new to programming and my teacher assigned me this very confusing lab. I have to create a program that uses the Scanner in String input and Output that will enable the user to convert
double -> int
int -> byte
int -> short
int -> hex-string
The output should look something like this:
Syntax: convert <value> <type>
convert 15.5 int ~> 16
convert 128 byte ~> -128
<type>: int, byte, short, hex, decimal
Syntax: max <type>
max byte ~> 127
<type>: int, byte, short
Command ~> convert 15.5 int
Result: 16
Command ~> convert 128 byte
Result: -128
Command ~> max short
Result: 32767
Command ~> convert 158342834 hex
Result: 9701eb2
I would be eternally grateful if someone could help me with this program. Thank you.