Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 E eg Ejsmith.
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 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 A or B above not just the outputted text in the console
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 eg 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 doublequotes 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 zero We ought to initialize all integers with a value of
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started