Question: JAVA * * My code does not give me exactly the sample input and output mentioned in the question.. kindly make the necessary changes to

JAVA*
*My code does not give me exactly the sample input and output mentioned in the question.. kindly make the necessary changes to let it match the sample input and output both*
Problem: ACSL Scrabble is a lettered tile game played on a grid game board. The board for this program will be 4 x 10. The grid squares are numbered as below:
the grid is from the numbers from 1 to 40
The squares that are every other multiple of 3(3,9,15...) are Double Letter score squares.
The squares that are multiples of 5 and not used above are Triple Letter score squares.
The squares that are multiples of 7 and not used above are Double Word score squares.
The squares that are multiples of 8 and not used above are Triple Word score squares.
Letter values will come from the following chart:
A, E -1 point D, R -2 points B, M -3 points V, Y -4 points J, X -8 points
INPUT: There will be 6 lines of input. The first line will give the letters of the word. The word will always have 4 letters. The remaining 5 lines will be starting locations for the word. Words will only be placed horizontally across the grid.
OUTPUT: For each starting location, print the total points scored by the word. No word will have more than one word score multiplier.
SAMPLE INPUT
1. J, A, V, A
2.1
3.2
4.4
5.12
6.21
SAMPLE OUTPUT
1.18
2.17
3.32
4.30
5.66
Code:
public class Main {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
int[] Array_scrbl ={1,1,3,2,3,4,4,2,1,8,4,3,3,1,1,3,4,1,1,1,1,4,3,8,4};
System.out.print(\"1.\");
String w = scnr.nextLine().toUpperCase().replaceAll(\",\\\\s*\",\"\");
char[] L = w.toCharArray();
int[] startingLocation = new int[5];
//System.out.println(\"Enter the starting location\");
for(int i =0;i<5;i++){
System.out.print((i +2)+\".\");
startingLocation[i]= scnr.nextInt();
}
for(int i=0;i<5;i++){
int current = startingLocation[i];
int total_points =0;
for(int j =0;j<4;j++){
char charLetter = L[j];
int value = Array_scrbl[charLetter -\'A\'];
if (current %3==0){
total_points+=2*value;
}
else if(current%5==0){
total_points+=3*value;
}
else{
total_points=total_points+value;
}
current++;
if(current>40){
current =1;
}
}
int multiplier =1;
if((current-1)%7==0){
multiplier=2;
}
else if((current-1)%8==0){
multiplier =3;
}
total_points = total_points*multiplier;
System.out.println((i+1)+\".\"+total_points);
}
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!