# Numerology Program in java

In this post, we will learn Numerology Program in java Programming language.

## Question:

Write a program to find the numerological value for a given name.
Note: Store the numerological number and the corresponding character in a 2-D array(2*26). Always the given name should be in a capital case,else the name is not valid. Check for the valid name, if the name is invalid print the message “Invalid name”.There should not be any space in the name provided.
For example:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
1 2 3 4 5 8 3 5 1 1 2 3 4 5 7 8 1 2 3 4 6 6 6 5 1 7

Sample Input 1:
SUDHA

Sample Output 1:

Your numerology no is:19

Sample Input 2:
kiran

Sample Output 2:

Invalid name

Sample Input 3:
ANI34

Sample Output 3:

Invalid name

### CODE:–

```import java.util.*;
public class Numerology
{
char[][] num_val={{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H','I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'},
{1, 2, 3, 4, 5, 8, 3, 5, 1, 1, 2, 3, 4, 5, 7, 8, 1, 2, 3, 4, 6, 6, 6, 5, 1, 7}};
public char numerological_value(char chr)
{
for(int i=0;i<26;i++)
{
if(chr==(num_val[0][i]))
{
return num_val[1][i];
}
}
return 0;
}
public static void main (String[] args) {
Scanner sc=new Scanner(System.in);
Numerology obj=new Numerology();
String name=sc.nextLine();
int len=name.length();
int flag=0, val=0;
for(int i=0; i<len;i++)
{
char r=name.charAt(i);
int temp=(obj.numerological_value(r));
if(temp==0)
{
System.out.println("Invalid name");
flag++;
break;
}
else
{
val+=(int)temp;
}
}
if(flag==0)
{
System.out.println("Your numerology no is:"+val);
}
}
}```
```public class Student
{
private int id;
private String name;
private int[] marks;
private float average;
public void setId(int id)
{
this.id=id;
}
public int getId()
{
return this.id;
}
public void setName(String name)
{
this.name=name;
}
public String getName()
{
return this.name;
}
public void setMarks(int[] marks)
{
this.marks=marks;
}
public int[] getMarks()
{
return this.marks;
}
public void calculateAvg()
{   float sum=0;
for(int i=0;i<this.marks.length;i++)
{
sum+=this.marks[i];
}
average=(float)(sum/(this.marks.length));
setAverage(average);
}
{int flag=0;
for(int i=0;i<this.marks.length;i++)
{
if(this.marks[i]<50)
{
flag++;
}
}
if(flag>0)
{
}
else
{
if(this.average>=80 && this.average<=100)
{
}
else if(this.average>=50 && this.average<=79)
{
}
else
{
}
}
}
public void setAverage(float average)
{
this.average=average;
}
{