Assigned java class name as: calculate-payment Assigned java class name as: Proc
ID: 3583320 • Letter: A
Question
Assigned java class name as: calculate-payment Assigned java class name as: Process_payment Assigned java class file name as: BMI_calc.txt Assigned java class file name as: Process_print.java Assigned java class file name as: Record registration.java Assigned java class name as: my_income.java Assigned a primitive variable name as: Pmt Assigned a primitive variable name as: int You want to define a constant for your class, what keyword you should use? Answer in ANS Line (1). Where could you define the constant? Right after the class name? or within the main method? Answer in NAS Line (2) ANS: Line (1) Check one with x: [] int [] double [] String [] final [] class [] Math. final Line (2) Check one with x: [] Right after the class, [] within the main method, [] either place Write java console I/O statements to complete the code that will allow user to enter the values of these variables: (keyboard object already defined as: k) ANS: Line (1) Line (2) Line (3) Write one console O/P statement to display the following sentence in one (1) line: Answer in ANS Line (1) Write one console O/P statement to display the following sentence in three (3) lines for 3 words: Answer in ANS Line (2) Write one GUI O/P statement to display the following sentence in one (1) line: Answer in ANS Line (3) Write one GUI O/P statement to display the following sentence in three (3) lines for 3 words in the message popup box: Answer in ANS Line (4) I like java ANS: Line (1) Line (2) Line (3) Line (4) What O/P is produced by the following statements? ANS in Line (2)Explanation / Answer
3) 1) Invalid: Java class naming convention should be usually CamelCase, hence calculate_payment doesn't start with an upper letter.
2) Unconventional: Java follows CamelCase.
3) Invalid: Abbreviations shouldn't be used.
4) Unconventional: Java follows CamelCase. Hence the second word of theclass name should start with an upper letter.
5) Invalid: No space between the file name.
6) Unconventional: Must follow CamelCase.
7) Invalid: Keyword cannot be used as a variable name.
8) Invalid: Keyword cannot be used as a variable.
4) Line 1: Answer is the keyword "final".
Line 2: Answer is "Within the Main method"
5) Line 1: import java.util.Scanner;
Scanner scan = new Scanner(System.in);
v1 = scan.nextInt();
Line 2: v2 = scan.nextDouble();
Line 3: v3 = scan.nextLine();
6) Line 1: System.out.println("I like java");
Line 2: System.out.println("I like java");
Line 3: System.setOut("I like java");
Line 4: System.setOut("I like java");
7) d is 6
s is 16