Hi all,
I'm just starting java and had to create a method to return the amount of text messages needed for a message x characters long. I'm having trouble compiling and not sure exactly why
public void msgsReqd(int msgLength)
{
int numMsgs, smsLength = 160;
msgLength / smsLength = numMsgs;
if (msgLength % 160 >= 1)
{
numMsgs = numMsgs + 1;
}
if (numMsgs == 1)
{
System.out.println("You will need " + numMsgs + " text");
}
else
{
System.out.println("You will need " + numMsgs + " texts");
}
I am getting an unexpected type error at the line msgLength / smsLength = numMsgs. I have tried changing to msgLength / 160 with the same error. I know its probably something idiotic but I've been staring at it for 20 mins now so any help would be appreciated.
PS this method is part of a larger class in which I have a number of other practice methods which are all working fine and using BlueJ so not a bracket issue.