This is the tester class.
import java.util.Scanner;
public class NumbersTester
{
public static void main(String[] args)
{
String s = "";
Scanner in = new Scanner(System.in);
System.out.print("Enter digits: ");
int n = in.nextInt();
s = Integer.toString(n);
System.out.println(countDigits(s));
Numbers s = new Numbers(int n);
}
}
This is my other class:
import java.util.Scanner;
public class Numbers
{
private int n;
public Numbers()
{
int n = intn;
}
}
public static int countDigits(String s)
{
int count = 0;
for (int i = 0; i < s.length(); i++)
{
if (s.charAt(i) == '7')
{
count++;
}
}
return count;
}
}
I am not sure what i am missing and would really appreciate help.
thank you!