This is my code so far and I have 1 error popping up on me.
Am I doing anything wrong.
import java.util.Scanner; public class JavaTheHut_MutlipleClass { private int number; public JavaTheHut_MultipleClass () { System.out.println ("Welcome to the MultipleClass object!"); } public void getNumber () { Scanner input = new Scanner (System.in); System.out.print ("Please enter a non-negative, integer whole value: "); number = input.nextInt(); } public void displayResults () { System.out.printf ("%d: ", number); } public boolean isEven () { if (number % 2 == 0) System.out.printf("%d=EVEN\n" , number); else System.out.printf("%d=ODD\n" , number); } public boolean isMultiple () { if (number % 13 == 0) System.out.printf("%d=MULTIPLE\n" , number); else System.out.print("%d=NOT\n" , number); } }
This is my error:
JavaTheHut_MultipleClass.java:27: error: invalid method declaration; return type required
public JavaTheHut_MultipleClass ()
^
1 error
This is what my outcome should look like using the code and its tester code:
Welcome to the MultipleClass object!
0:MULTIPLE:EVEN
Please enter a non-negative, integer whole value: 39
39:MULTIPLE:ODD
This is my test code:
public class JavaTheHut_MultipleClassTest { public static void main ( String args [] ) { JavaTheHut_MultipleClass foo = new JavaTheHut_MultipleClass(); foo.displayResults(); foo.getNumber(); foo.displayResults(); } }