Hello!
I am doing a task and wondered if someone could help me.
Here is the task:
Create a program that allows a user to enter 10 words.
The program will prompt each user to show how far she has come, for example: "Enter the word number 6:"
The program will then print all the words forwards, backwards and every other word.
Program code should have high cohesion. It should therefore consist of three classes. Class names should be the start point, Dialog and Printing.
One class will be responsible for being the entry point.
The second class will be responsible for the dialogue with the user entering keywords, and to manage printing.
The third class will be responsible for printing.
Clarification: By "backwards" here means "in reverse" in relation to the order of the words were written in.
My code:
public class Startpunkt { public static void main(String[] args) { new Dialog(); } } import javahjelp.Konsoll; public class Dialog { public Dialog(){ String[] rekke = new String[10]; for (int i=0;i<10;i++) rekke[i] = Konsoll.readLine("Write a word "+i); int i; for (i=0;i<10;i++) new Print(); } } public class Print { System.out.println("You wrote " +rekke[i]) }
The last class is my problem. How do i print something from class Dialog ? And print the other way I'm supposed to (watch task)? I need help