Answered step by step
Verified Expert Solution
Link Copied!

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions

Question

What do you like to do for fun/to relax?

Answered: 1 week ago