so this is my first homework ever in Java so heres what I need to do:
1)a project named LetterCounterExample(done)
2)a main class for the project of the same name as the project (done)
3)a class called LetterCounter (done) with the following members:
i. field of type char named letter
ii. a method of return type int named doCount(String) that takes one argument of type String and returns the number of times the character in the variable letter occurs in the given string.
4)create a Junit test using the string abracadabra and verifies that the methid returns the correct value
---------------------------------------------------------------------------
Now I got sort of an idea of what stuff to put but I have no idea how to put it on a java syntaxis yet
Basically I know I need:
a char variable for the letter which the user would give a value to
a string variable for the string that is gonna be searched given by user
a counting variable that is what is gonna be returned by doCount(string)
I know the counting would involve some sort of for function to check each character of the string given
I know Id need some sort of print and scan functions to ask and receive the chars and strings (I know how to program a little in C but nothing at all in Java lol)
But I have no idea how to begin to stablish the codes for the methods I need or how to do a scan of an input in Java and save it on a variable.
Any advice on what to do is welcomed, no I dont want the answer to everything or what would be the point in trying to learn. I got sort of a picture of how stuff would look clearer on C language but sadly its a Java class lol.
I would do the test part later once I can understand this o: