Question: ( 2 pts ) True or False. Constructors are not inherited. True _ _ _ _ _ False _ _ _ _ _ _ 2

(2 pts) True or False. Constructors are not inherited.
True_____ False______
2.
(2 pts) This is one or more statements that are always executed after the try block has executed and after any catch blocks have executed if an exception was thrown.
try block
catch block
finally block
protected block
3.
(2 pts) This is an internal list of all the methods that are currently executing.
invocation list
call stack
call list
list trace
4.
(2 pts) This is the process of converting an object into a series of bytes that represent the objects data
serialization
deserialization
dynamic conversation
casting
5.
(2 pts) This method may be called from any exception object and it shows the chain of methods that were called when the exception was thrown.
printInvocationList
printCallStack
printStackTrace
printCallList
2
6.
(2 pts) This type of control appears as a rectangular region and can accept keyboard input from the user
Button
Label
TextField
InputField
7.
(2 pts) This type of node can have other nodes as children.
leaf node
master node
anchor node
branch node
8.
(2 pts) This type of node cannot have other nodes as children.
leaf node
root node
container node
branch node
9.
(2 pts) All JavaFX application must extend the __________ class.
JavaFX
Application
GUI
start
10.
(2 pts) You can use this class to load an image into memory.
Imageview
ImageLoader
Image
Img
3
4
Part 2(80 pts)
Create a child class called Goat whose parent class is called Animal. The Goad class has one field called legs and a constructor that sets the legs to 4.(5 points)
Create an interface called Test with two abstract methods called add and prod and have one double parameter each. (6 points)
Implement the add method and the prod method from Q2 in a class called TestMe. The add method should return the argument plus 10 and the prod method should return the argument multiplied by 20.(16 points)
Correct the following code so that it checks to see if a String s contains the letter k. Assume that the string is created already in the program and is referenced by the variable s.(10 points)
s String = "I love Java";found boolean = False;for(i ==1; i > String.length; i--){ if (s.atChar(k)='k'){ boolean found = True; }}
Given the following class
Public class Parent {
public void makeNoise ()
System.out.println ( I am your parent. Listen to me);
}
Write a class called Child that overrides the makeNoise method. You can output anything. (10 points)
5
What is wrong with the following code. (4 points)
public class X
{
public X (int i)
{
System.out.println(5) ;
}
}
public class Y extends X
{
public Y()
{
System.out.println(25) ;
super(25);
}
}
Answer:
(6 points) Given a class named myMath with a no arg constructor that implements the following interface.
public interface Multiply{
//abstract methods
public abstract double getSum (int x, int y);
public abstract double getProd (int a, int b);
}
Write the statements that
Create a myMath object (2 points)
Call the two methods then add their values and place them in a variable called total. (Use your own values for the methods arguments).(4 points)
(a)
6
(b)
What is the return value of the following method when it is called with the string I will not use 1 online help on my homework anymore as an argument (8 points)
public static int check_digit (String s)
{
for(int j =2; j <= s.length -1; j++)
{
if (Character.isDigit(s.charAt(j)== true)
{
return j +2;
}
}
return j -3 ;
}
7
Create a try-catch block to catch the ArithmeticException that can occur when the two variables are divided and stored in a variable called answer (10 points)
public static void main(String[] args)
{
double x =25;
double y =0;
}
8
Write a javaFX program with the following properties (20 points)
create a label with the words "Enter cost of a phone", a textfield, and a button (with the word Price)
when a user clicks the button after entering a cost in the textfield, a label is displayed with the cost of the phone and the taxes (taxes =5% of cost).
//Here are the given class fields and layout to help you with the coding.
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.control.Button;
import javafx.event.EventHandler;import javafx.event.ActionEvent;
public class PenStore extends Application
{
// Create the display label reference (1 point)
// Create the phone textfield label reference (1 point)
public static void main(String[] args)
{

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!