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

Suggest a suitable Java data type that can be used to store each of the followin

ID: 3857484 • Letter: S

Question


Suggest a suitable Java data type that can be used to store each of the following values: i) Name of a person, for example: Johnson ii) Gender of a person, for example: F iii) An indicator to identify whether a transaction is successful, for example: true iv) Cost of an item, for example: 8.50 v) Number of students in a class, for example: 35 State whether the following statements are true or false. For false statements, explain why. i) The default case is required in the switch selection structure ii) The break statement is always required in the default case of a switch selection structure iii) Switch statements cannot test for a range of values

Explanation / Answer

1)Suggest suitable data types

i)Name of a person==String type

ii)Gender of a Person ==enum

example public enum gender={M,F}

iii)An indicator to specify a transaction is successful=boolean

iv)Cost of an Item=double

v)Number of students in a class=int

2)True or False

i)The first statement is false because we will add it to execute some think if non of the case is matched

it is not compalsary to add it is optional

ii)second statement is false because we use break statement in switch to stop the rest of the case statement follwed after the match case is found as defalut is the last case of switch so break is not necessary for default

iii)last statement is true we cannot test for a range of values

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