A school is giving away merit certificates for the students who have scored 90 percentage and above in class 10. The following program is based on the specification given below. Fill in the blanks with appropriate Java statements. class name : Student Member variables: String name, double per, String cer Member methods: void input(), void merit(), void display(), void main() import java.(i) __________ .*; class Student { String name; double per; String cer; void input() { Scanner obj = new Scanner(System.in); System.out.println("Enter name, Percentage"); name = obj.next(); per = (ii) __________ } void merit() { if( (iii) __________ ) cer = "AWARDED"; else cer = (iv) __________ } void (v) __________ { System.out.println(name); System.out.println(per); System.out.println(cer); } void main() { Student s = new (vi) __________ s.input(); s.merit(); s.display(); } }
Fill in blank (iii): if( __________ )
Topic: Writing a condition from a specification
Try it
Pick an option and check your answer. The full worked answer is below either way.
Answer
(a) per >= 90.
Read the requirement exactly: "90 percentage AND ABOVE" means 90 itself qualifies, so the test must include equality — per >= 90. Option (c) with a strict > would wrongly deny a certificate to a student scoring exactly 90, which is the single most common error in condition questions. Whenever a question says "and above", "at least" or "not less than", the operator carries the equals sign.
per >= 90.