Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

00000011111. program requirements The following are requirements of ALL programs

ID: 3798953 • Letter: 0

Question

00000011111. program requirements

The following are requirements of ALL programs

You must write instructions to the screen to tell the user exactly what you want him/her to do. Your instructions must be very clear and descriptive, and should not contain any spelling or grammar errors.

part 1

Begin by creating a new Java project.
The name of the project should be: Assignment06

Create a new Java class inside your project folder.
The name of the class should be: Alphabet

Write a java application program that will print the uppercase letters of the English alphabet to the screen, all on one line, each one separated by a space.

The output of this program should look like this:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

This program always produces the same result every time it is executed. This program does not get any values from the keyboard, and therefore does NOT need an import statment, and does NOT need a "Scanner keyboard" line to set up the keyboard.

Program Restrictions

You CANNOT use any print statements that print literals to the screen. A literal is any value that is not stored in a variable. For example, the following lines are prohibited in this program:

System.out.println("A B C D E F G...");
System.out.println('A' + 'B' + 'C' + 'D'...);
System.out.println("A" + "B" + "C" + "D");

You ONLY allowed to use print statements that print variables to the screen.
(i.e. System.out.println(myVariable); // where myVariable is a variable that is holding some value)

You CANNOT use any String variables in your program.

You CANNOT use more than 2 variables in your program (although, you really don’t even need this many).

Hint

Think about the ASCII / Unicode tables, and the fact that character variables actually do store integer values.

Think about how integers can be type cast into characters

Explanation / Answer

Alphabet.java


public class Alphabet {

  
   public static void main(String[] args) {
       for(int i=65;i<=90; i++){
           char ch = (char)i;
           System.out.print(ch+" ");
       }

   }

}

Output:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z