1. (TCO 7) Which of the following statements
are true? (Points : 5)
Interfaces contain one and only one implemented method, a
constructor.
Interfaces are defined inside
an abstract class.
All methods defined in an
interface must be implemented when used by another class.
A true object-oriented design
must contain as least one interface.
abstract class; interface interface; base class None of the above |
object hierarchies instantiated classes contracts None of the above |
B. Programming to an interface makes the code more logical. Both A and B None of the above |
Code markers should be used to show what the developer still needs to do Comments showing the intent of the code All of the above None of the above |
Using namespaces as a container for logically related items Using namespaces to create global types All of the above None of the above |
3 5 4 |
void GetFavoriteColor (){return favoriteColor;}, void SetFavoriteColor (int favoriteColor){this.favoriteColor = favoriteColor;} string GetFavoriteColor (){return favoriteColor;}, void SetFavoriteColor (string favoriteColor){this.favoriteColor = favoriteColor;} string GetFavoriteColor (){this.favoriteColor = favoriteColor;}, void SetFavoriteColor (string favoriteColor){return favoriteColor;} |
Question 9. 9. (TCO 7) Which of the following declares an abstract method in an abstract class? (Points : 5) |
public abstract void
DisplayResult();
public void abstract
DisplayResult();
public void
DisplayResult{};
public abstract void
DisplayResult() {}
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
1. (TCO 7) Which of the following statements are true? (Points : 5) Interfaces contain...
Abstract classes and Interfaces problems 10. Explain one similarity and one difference between abstract classes and interfaces. 11. Consider the following declarations. public interface Shape{ int someFunction(Shape other); //other functions not shown } public class Square implements Shape {/*implementation not shown*/} Which of the following function headings of someFunction must be added to the declaration of the Square class such that it will satisfy the Shape interface? public int someFunction (Shape other) public int someFunction (Square other) public boolean someFunction(Object...
Abstract classes and Interfaces problems 10. Explain one similarity and one difference between abstract classes and interfaces. 11. Consider the following declarations. public interface Shape{ int someFunction(Shape other); //other functions not shown } public class Square implements Shape {/*implementation not shown*/} Which of the following function headings of someFunction must be added to the declaration of the Square class such that it will satisfy the Shape interface? public int someFunction (Shape other) public int someFunction (Square other) public boolean someFunction(Object...
In this lab you will work with abstract classes/interfaces. (Java Program) You will be implementing a basic employee schema within a company. The Employee class will be an abstract class that will contain methods applicable to all employees. You will then create 2 classes called SoftwareEngineer and ProductManager. Both are different employee types based on occupation. You will create an interface called Developer which will consist of specific methods that apply to only Developers (e.g. SoftwareEngineer class will implement this,...
Rewrite the Course class in Listing 10.6 to implement the comparable and the cloneable interfaces. The clone method must allow a deep copy on the students field. In addition, add the equals(Object o) and the toString() methods. Write a test program to invoke the compareTo, clone, equals, and toString methods in a meaningful way. Below is the Listing from the book that needs to be rewritten public class Course { private String courseName; private String[] students = new...
Question 1 1 pts Which of the following is not a valid class name in Java? O MyClass MyClass1 My_Class MyClass# Question 2 1 pts Which of the following statements is False about instance variables and methods? Instance variables are usually defined with private access modifier. Instance variables are defined inside instance methods. Instance methods are invoked on an object of the class that contains the methods. A class can have more than one instance variables and methods. Question 3...
Java program. Code the following interfaces, implement them, and use the interface as a parameter, respectively: a. An interface called Printable with a void print() method. b. An interface called EmployeeType with FACULTY and CLASSIFIED integer data. The value of FACULTY is 1 and CLASSIFIED is 2. a. A class called Employee to implement the two interfaces. Its constructor will initialize three instance data as name, employeeType, and salary. Implementation of method print() will display name, employeeType, and salary; salary...
Assignment4: Evaluate Arithmetic Expressions. Requirements: Implement a concrete ArrayStack class that extends the IStack interface as we discussed in the class (any other different Stack class implementation, even if it is implemented by yourself, will not receive any credit). Write a test class called Evaluate and a method that evaluates an arithmatic expression, which is given by a string. import java.util.Scanner; public class Evaluate { public static void main(String[] args) } // your implementation // obtain user's input from keyboard...
Java Code the following interfaces - An interface called Accountable with void withdraw(double) and double getBalance() methods, and an interface called AccountReceivable with a void deposit(double) method. Save these two interfaces in separate Java files. Then code a class, BusinessAccount, that implements the two interfaces defined above. Define and code the necessary instance variables and constructors. Override toString() so it will return the amount of a business account. Apply the particular operations, such as withdraw and deposit, required in implementing...
1. (TCO 1) What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j = 0; j < 5; j++) cout << list[j]; (Points : 4) 0 1 2 3 4 0 5 10 15 0 5 10 15 20 5 10 15 20 Question 2.2. (TCO 1) What is stored in alpha after the following code executes? int alpha[5] = {0}; int j; for (j = 0; j...
Question 1 (5 points) Question 1 Unsaved What is displayed on the console when running the following program? public class Quiz2B { public static void main(String[] args) { try { System.out.println("Welcome to Java"); int i = 0; int y = 2 / i; System.out.println("Welcome to Java"); } catch (RuntimeException ex) { System.out.println("Welcome to Java"); } finally { System.out.println("End of the block"); } } } Question 1 options: The program displays Welcome to Java two times. The program displays Welcome to...