Question: Create a Java Console application, and name the project E 1 e . g . E 1 jsmith. Add a new Java class file to

Create a Java Console application, and name the project E1 e.g. E1jsmith.
Add a new Java class file to the project and name the class Grades
Put your name, class, class time, and assignment number in as a comment on Line 1 of the Grades.java
class.
Setup the Scanner class, including the import statement, on your own without a prompt after this
exercise.
Within the main method, inside its curly braces, start typing at the top of the code block.
When testing your program, use your own name for the Student.
When taking a screenshot for submission, ensure that the entire Console tabs content is included
similar to Figure 1-A or 1-B above (not just the outputted text in the console).
1. Declare Variables
a. Declare a variable called studentName. Since names contain alphabets, only the data types
String and char are possible. However, since we need multiple characters in a name, the
data type must be String visualize a string of characters.
Variables are declared preceded by the appropriate data type keyword (e.g. int, float, etc.),
followed by the variable name or identifier. On that same line, initialize the String variable
with a value of an empty string. To initialize a variable, you will use the assignment operator
(=). On the right side of the assignment operator, put in two double-quotes without any
spaces between them. The value in the string variable becomes whatever is inside the double
quotes. Since we will ask the user for their name, studentName will get the default value of a
blank or empty string.
b. Declare a variable called score, which will store the numerical score a student receives in a
class. Since we want to store a number, we have a variety of numerical data types available to
us. Let us add a simplification: our scores will be whole numbers. Therefore, the most
appropriate data type is integer. We declare integers by using the keyword int as the data
type.
Again, type in data type first followed by the variable name. Then initialize the variable with a
value of 0(zero). We ought to initialize all integers with a value of 0.
c. Declare a variable called grade, which will store the letter grade a student receives. Since the
letter grade requires alphabetical data, both the char and String data types could be used.
Since we want only one character of data to be stored, lets use the char data type. We
declare characters by using the keyword char as the data type.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!