Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Complete the main method in Program 2 by filling in the blanks with an appropriate statement based on the output shown in Figure 1.
Complete the main method in Program 2 by filling in the blanks with an appropriate statement based on the output shown in Figure 1. The ordinal value for Quiz is 1 Both the quiz and the exercise have the same mark. Figure 1 //Program 2 class MyAssessment { enum CourseWorks { Test (30), Quiz (15), Exercise (15); 9 10 11 12 class MyScore { 13. 14 15 16 17 18 19 20 } } public int mark; private CourseWorks (int mark) ( this.mark = mark; } public static void main (String [] a) { (i) (ii) } System.out.println ("Both the quiz and the exercise have the same mark."); System.out.println("Both the quiz and the exercise have different marks."); else (i) System.out.println("The ordinal value for " + CourseWorks.Quiz + " is " + CourseWorks.Quiz.mark); (ii) if (MyAssessment. Courseworks.Quiz.mark.compareTo (My Assessment. CourseWorks. Exercise.mark)) (ii) if (Courseworks.Quiz.mark == CourseWorks.Exercise.mark) (i) System.out.println("The ordinal value for " + MyAssessment. CourseWorks.Quiz + " is " + MyAssessment.CourseWorks.Quiz.mark); (i) System.out.println("The ordinal value for " + MyAssessment. CourseWorks.Quiz + " is " + MyAssessment. CourseWorks.Quiz.ordinal()); (ii) if (Courseworks.Quiz.mark.compareTo(Courseworks.Exercise.mark) == 0) O (ii) if (My Assessment. Courseworks.Quiz.mark.compare To (MyAssessment. CourseWorks. Exercise.mark) == 0) O (ii) if (MyAssessment. CourseWorks. Quiz.mark == MyAssessment. CourseWorks. Exercise.mark) (i) System.out.println("The ordinal value for " + Courseworks.Quiz + " is " + Courseworks.Quiz.ordinal()); (ii) if (Courseworks.Quiz.mark.compareTo (CourseWorks.Exercise.mark))
Step by Step Solution
★★★★★
3.46 Rating (166 Votes )
There are 3 Steps involved in it
Step: 1
The correct completion for the main method in Program 2 based on the output shown in Figure 1 is i S...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started