Rohan wants a magic board, which displays a character for a corresponding number for his science exhibition. Help him to develop such application in java language.
For example when the digits 65,66,67,68 are entered, the alphabet ABCD are to be displayed.
[Assume the number of inputs should be always 4 ]
Sample Input 1:
Enter the digits:
65
66
67
68
Sample Output 1:
65-A
66-B
67-C
68-D
Sample Input 2:
Enter the digits:
115
116
101
112
Sample Output 2:
115-s
116-t
101-e
112-p
Answers
Answer:
Explanation:
Desired conversion from word to number in Java language is presented below:
was trying to make letters into numbers in c++. When I write in console it should count modulo and type out if ship is coming (i did all, but can't make letters into numbers :/ )
This what should happen: ABC a = 1; b=2; c=3 1*2*3=6....So I need to write a word and it should be separated into letters and converted into numbers like that.I am just learning and I don't know much :)
My current code: int shipnum, groupnum, moduleship, modulegroup; cout << "type ship number "; cin >> shipnum; cout << "type group number "; cin >> groupnum;/*shipnum dabar 5... (5 mod 2):: groupnum dabar 3... (3 mod 2)*/: moduleship = shipnum % 47; //skaiciuojam moduli...modulegroup = groupnum % 47;if (moduleship == modulegroup) { : cout << "YES ship is coming for you :)"; }:else if (moduleship != modulegroup) { // "!=" reiskia "nelygu": cout << "SORRY, NO ship for you :(";}
Answer:
import java.util.Scanner;
public class AsciValue{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int num;
char ch;
13 int i=0;
14 System.out.println("Enter the digits:");
15 while(i<4){
16 num=sc.nextInt();
17 ch = (char) num;
18 System.out.println(num +"-" +ch);
19 i++;
20 }
21 }
22
23 }
explanation