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

User-defined identifiers come in 3 types: classes, methods, and variables. Follo

ID: 3743469 • Letter: U

Question

User-defined identifiers come in 3 types: classes, methods, and variables. Follow the coding rules for identifiers. Keep in mind that method identifiers usually begin with an action word.

Here are the coding formats for each type of identifier:

Identifier Type

Format

Example

Class:

accessModifier class nameOfClass

public class Employee

Method:

accessModifier static returnType nameOfMethod()

public static void hireEmployee()

Variable:

dataType nameOfVariable = initialValue;

String employee = “”;

Code a variable that stores the cost of a new computer.

Code a class header for a program about diseases.

Code a method header for driving a stick-shift.

Code a variable that stores the model of a car.

Code a class header for a program about universities.

Code a method header for Christmas shopping.

Code a class header for a program about the Olympics.

Code a method header for timing a one-mile relay.

Code a variable that stores the best place to retire.

Identifier Type

Format

Example

Class:

accessModifier class nameOfClass

public class Employee

Method:

accessModifier static returnType nameOfMethod()

public static void hireEmployee()

Variable:

dataType nameOfVariable = initialValue;

String employee = “”;

Explanation / Answer

Code a variable that stores the cost of a new computer.

double costOfComputer;

Code a class header for a program about diseases.

public class Diseases

Code a method header for driving a stick-shift.

public static void DriveStick( )

Code a variable that stores the model of a car.

String modelOfCar = “”;

Code a class header for a program about universities.

public class Universties

Code a method header for Christmas shopping.

public static void shopForChristmas( )

Code a class header for a program about the Olympics.

public class Olympics

Code a method header for timing a one-mile relay.

Code a variable that stores the best place to retire.

String Bestplace="";

Happy learning

Please rate

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote