Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello! Quick question. Why won't this run? When I put it into a compiler it says that Error: Main method not found in class LetterInventory,

Hello! Quick question. Why won't this run? When I put it into a compiler it says that Error: Main method not found in class LetterInventory, please define the main method as: public static void main(String[] args)or a JavaFX application class must extend javafx.application.Application, or that there is no main method.

Java

image text in transcribed

image text in transcribed

| cd/ home/cg/root/63ec8dd04821a Error: Main method not found in class LetterInventory, please define the main method as: public class LetterInventory { public static void main(String[] args) public static final int LETTER = 26; or a JavaFX application class must extend javafx.application.Application import java, util, ; publie cless Letterlmentory (| public stetic final int LITTER - 26; privete int [] lettercount; private int letterhun; private int size; //Constructor. Takes the string, onalyzes the cheracters, and creates an int array whepe the / urber of each letter is kept. Only excepts letters, and all letters are converted to leaer / / enose public LetterImentory(String dato) f lettercount = new int [L[TTCR]; for (int 1=0;1=88 lettertum 825 ) \{ letterCount[lettertum] size +i ) /iketurns the size of the constructed erray, public int sireo f \} return size; / / iveluates if the constructed arpey is enpty. public boolean isinpty() f \} return ( size =0); //pre a Assures thot there are nurbers in the arpoy. //post: Returns the number of tires a given leteer oceured in the string. /Af a non alphobetie cheracter is passed, on Hilegald ararentixception is thormi. public int get(char letter) \{ har ch - Character, tolowercase(letter); if (ch>z11dh7a) f \} int nun = ch =e4; int total = letter[ount[nun]; return total; \} //pre there is a 26 elenent arpoy with a count for eoch lettor of the alphabet. //posti A stering of all the letters is returned in alphebntical erder, with equel nurber (l lekters that are in the ceigirel string. publie string tostring() f String result = " ["; for (int 11;i ' z ' 1 nemletter a1 value \& D) \{ throw nem Illegolargunent Exceptien(); \} if (lettercount [newLetter] > value) f size =- letter[ount[nembetter]; lettercount[nembetter] - value; size i= value; \} //pre t the elient hes 2 int erays they wish to oed toesther. //pesti A third Letterinventory thet is the sin of the first two is returned. public LetterImentory ada(Letterimentory other) \{ LetterImventory here - new LetternwentoryO; for (int t=i; LitTeR; i+1){ here. letterCount [i] - letterCount [i]+ other. letterCount [i]; y here, size = size + other, size; return here; \} //pre : The elient hes 2 int errays they wish to subtrect, //posti A third tetterinventory is returned that is the difference of the tho, /lif the result would be negetive, nutl is returned. public LetterImentory subtract(LetterImentory other) f Letterlmventory now = new LetterInventaryO; for (int i=1;i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

=+ 5. Describe the impossible trinity.

Answered: 1 week ago

Question

HOW MANY TOTAL WORLD WAR?

Answered: 1 week ago

Question

Discuss the scope of financial management.

Answered: 1 week ago

Question

Discuss the goals of financial management.

Answered: 1 week ago

Question

Who will manage the project and liaise with the external providers?

Answered: 1 week ago

Question

How will we measure their success and effectiveness?

Answered: 1 week ago