2

TextIO cannot be resolved could you help me what i'm missing in my below code?

Do i need to create a class as TextIO
or do I need to create local variable?

package practice.september;

import java.io.*;
import java.util.*;

public class EggsCount {

    public static void main(String[] args) {
        int eggs;
        int dozens;
        int extras;

        TextIO.put("How many eggs do you have?  ");
        eggs = TextIO.getlnInt();

        dozens = eggs / 12;
        extras = eggs % 12;

        TextIO.put("Your number of eggs is ");
        TextIO.put(dozens);
        TextIO.put(" dozen and ");
        TextIO.put(extras);
        TextIO.putln();
    }
}
Juan Carlos Mendoza
  • 5,736
  • 7
  • 25
  • 50
VoidDemon
  • 31
  • 2
  • 6
  • Possible duplicate of [Eclipse error ... cannot be resolved to a type](https://stackoverflow.com/questions/15794821/eclipse-error-cannot-be-resolved-to-a-type) – Frakcool Sep 08 '17 at 16:57
  • 2
    `TextIO` is not a class that exists in your imports `import java.io.*;` & `import java.util.*;`. Try to go back to where you referenced learnt about `TextIO` and get the relevant implementation of the same. It is an overkill to re-write `TextIO`. I would use `java.util.Scanner` for input and `System.out.println` for output. – kaza Sep 08 '17 at 17:04
  • @bulbus Scanner worked thanks – VoidDemon Sep 08 '17 at 18:45

2 Answers2

0

In order to get TextIO to work you need to have your TextIO.java file in the same directory as your source code (working directory).

You can do this by going to http://math.hws.edu/eck/cs124/javanotes6/source/index.html, scrolling to the bottom of the page, and use the "save as" command in your current web browser to get a copy of the file "TextIO.java" in the working directory.

Best Regards.

0

In order to enable TextIO in your code, you'll need to include the TextIO file in the same directory as your code.

Abdulfattah
  • 111
  • 2
  • 6