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

The key word new creates a new variable in memory creates a new class creates a

ID: 3859806 • Letter: T

Question

The key word new creates a new variable in memory creates a new class creates a new Java byte code file creates an object in memory What would be the value of discountRate after the following statements are executed? double discountRate: char custType = 'B': switch (cust Type) { case 'A': discountRate = 08: break: case 'B': discountRate = 06: case 'C': discountRate = 04: default: discountRate = 0.0: } 0.08 0 06 0 04 0.0 Which Scanner class method reads a String? readString() nextString() getString() nextLine() What would be the value of bonus after the following statements are executed? int bonus, sales = 85000: char dept = 's': if (sales > 100000) if (dept = = 'R') bonus = 2000: else bonus = 1500: else if (sales > 75000) if (dept = = 'R') bonus = 1250: else bonus = 1000: else bonus = 0: 2000 1500 1250 1000

Explanation / Answer

Q33)

Ans)Creates a Object in memory

Reason: syntax to create an object to the class in java

Classname referencevariable=new Classname();

_________________

Q34)

Ans)0.06

Reason: As the custType value is 'B' the corresponding case will be executed.In that manner Case 'B' will be executed.Then 0.06 will be assigned to the variable discountRate.

___________________

Q35)

Ans)1000

Reason:As the sales = 85000

then else if (sales > 75000) will be executed. In that (as the dept='S' ) else part will be called.so then 1000 will be assigned to the bonus.

so bonus=1000.

__________________Thank You

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