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 */
Escuela, estudio y materia
- Institución
- AP Computer Science A
- Grado
- AP Computer Science A
Información del documento
- Subido en
- 25 de enero de 2024
- Número de páginas
- 10
- Escrito en
- 2023/2024
- Tipo
- Examen
- Contiene
- Preguntas y respuestas
Temas
-
ap computer science a unit 5 progress check mcq