Translating a good English program design into Java is not much more than recognizing which of the Five Concepts in the table below each line represents, and then spelling that concept in Java.
If your variable is used to count things or hold the number of something, then you need the whole-number type int as described in Lesson #2n). That same page also tells about variables that hold a simple true/false value, type boolean.
We started Lesson #5 introducing arrays. There are no such things as arrays in the English language, groups of things, so of course our English program has nothing that looks like arrays. Some of the places where have String variables, we might prefer to make them arrays of type char. Do you think you can do that? For example, we need to step through the word being guessed to look at individual characters, it's a good array candidate. This one line both declares and initializes an array of 99 characters, do you think that is enough for the longest word somebody might need to guess?
char[] word = new char[99];
So figure out what the program does with each variable, what its type should be, and then put a declaration for that variable at the top of the white space in your Hellow program. Don't forget to put a semicolon at the end of each statement line. Then click the "Compile" button to make sure there are no mistakes.
Java is very unforgiving about mistakes -- and that is a good thing! Our first Venus probe crashed and was essentially worthless because the Fortran compiler did not catch the kinds of mistakes that Java catches -- so you need to be very careful, and be glad the compiler caught it before somebody spent a million dollars and your program failed when it was needed (and you weren't around to fix it).
If there are mistakes, look carefully at the first of them to see what you did wrong, so you can fix it. That will usually clear up several following errors, so keep trying to compile after each repair. If you can't figure out what is wrong, get help. You don't necessarily know what to look for, nor what the error messages mean the first time you do this, but after a while you won't need so much help. That's what the instructor is here for.
The other part of the "Variables" line in the Five Concepts table below (but not shown) is the calculation of variable values. In English we have been using the command word "let" to signify that is what is happening. In Java the "let" is implied, the compiler can figure it out from the assignment operator "=". Otherwise it looks pretty much the same (except you need a semicolon at the end). Can you do that for the variable assignments (all the "let"s) in the English program? Leave blank lines as place holders for the lines you are not translating yet. Then click the "Compile" button to make sure there are no mistakes.
Character input and text output you are already familiar with in Java. Why don't you convert those English commands too? Click the "Compile" button to make sure there are no mistakes. Of course the program still cannot run correctly because the conditionals and iteration are not there yet. We'll do that after you turn the page.
Five Basic Concepts Sequence Iteration Conditional Variables Input/Output
Revised: 2021 June 3