Declare and initialize constants to represent the values


Discuss the below in detail:

Using Java Variables, Data Types, and Keywords

A. Can you tell me if I put the variables in the correct area?

Items listed below are legal Java variable names.

myIDNumber
yourIDNumber
this_is_a_year
number
floatNum
May13
Number

Items listed below ARE NOT legal Java variable names.
short
110number
One Number
NUMBER
$number

B. Declare and initialize constants to represent the following values. Use in, double, or String and choose meaningful names.

The price of a burger is $4.95. double PRICE_OF_BURGER = $4.95
The number of days in October is 31. int NUMBER_OF_DAYS_IN_OCTOBER = 31
The name of your cat is "Yogi". String CATS_NAME = "Yogi"
The length of a football field in yards in yards is 100. int FIELD_IN_YARDS = 100

-First calculate the profit, then calculate the sales price, then calculate the profit when the sale price used.

-Profit is defined as the retail price minus the wholesale price.

-The sales price 20% deducted from the retail price.

-The sales profit is defined as the sales price minus the wholesale price.

-Perform the appropriate calculations for the assignment statement.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Declare and initialize constants to represent the values
Reference No:- TGS01934375

Now Priced at $20 (50% Discount)

Recommended (93%)

Rated (4.5/5)