Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 x The grid squares are numbered as below:
the grid is from the numbers from to
The squares that are every other multiple of are Double Letter score squares.
The squares that are multiples of and not used above are Triple Letter score squares.
The squares that are multiples of and not used above are Double Word score squares.
The squares that are multiples of and not used above are Triple Word score squares.
Letter values will come from the following chart:
A E point D R points B M points V Y points J X points
INPUT: There will be lines of input. The first line will give the letters of the word. The word will always have letters. The remaining 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
J A V A
SAMPLE OUTPUT
Code:
public class Main
public static void mainString args
Scanner scnr new ScannerSystemin;
int Arrayscrbl ;
System.out.print;
String w scnrnextLinetoUpperCasereplaceAlls;
char L wtoCharArray;
int startingLocation new int;
Systemout.printlnEnter the starting location\";
forint i ;i;i
System.out.printi ;
startingLocationi scnrnextInt;
forint i;i;i
int current startingLocationi;
int totalpoints ;
forint j ;j;j
char charLetter Lj;
int value ArrayscrblcharLetter A;
if current
totalpointsvalue;
else ifcurrent
totalpointsvalue;
else
totalpointstotalpointsvalue;
current;
ifcurrent
current ;
int multiplier ;
ifcurrent
multiplier;
else ifcurrent
multiplier ;
totalpoints totalpointsmultiplier;
System.out.printlnitotalpoints;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started