AP Computer Science A Unit 5 Progress Check: MCQ Part A
AP Computer Science A Unit 5 Progress Check: MCQ Part A The Fraction class below will contain two int attributes for the numerator and denominator of a fraction. The class will also contain a method fractionToDecimal that can be accessed from outside the class. public class Fraction { /* missing code */ // constructor and other methods not shown } Which of the following replacements for /* missing code */ is the most appropriate implementation of the class? - -B. private int numerator; private int denominator; public double fractionToDecimal() { return (double) numerator / denominator; } The Thing class below will contain a String attribute, a constructor, and the helper method, which will be kept internal to the class. public class Thing { /* missing code */ } Which of the following replacements for /* missing code */ is the most appropriate implementation of the class? - -B. private String str; public Thing(String s) { /* implementation not shown */ } private void helper() { /* implementation not shown */
Written for
- Institution
- AP Computer Science A
- Course
- AP Computer Science A
Document information
- Uploaded on
- January 25, 2024
- Number of pages
- 10
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
ap computer science a unit 5 progress check mcq