To access an element in an arraylist object

As part of a bank account implementation, there is an account class and a checking account class. These two classes should be related by:

            abstract classes

            composition

            inheritance

            both composition and inheritance

 polymorphism

 

When using OOP, which of the following terms refers to a mechanism for a behavior, basically how it’s implemented?

            polymorphism

            dynamic binding

 

            composition

            inheritance

 

To access an element in an Array object,

            Use square brackets around an index value.

            Use the ArrayList’s element() method.

 

            Use the ArrayList’s get() method.

            Individual elements in an ArrayList can’t be accessed without doing a sequential query getSequential(), returning every element up to and including the element requested.

 

To access an element in an ArrayList object,

            Use square brackets around an index value.

            Use the ArrayList element() method.

 

            Use the ArrayList get() method.

            Individual elements in an ArrayList can’t be accessed without doing a sequential query getSequential(), returning every element up to and including the element requested.

 

What term below is defined as a message that tells the program that something has happened?

            a listener

            an action

 

            an interaction

            an event
 

 

Which item below is defined as an object?

            A String

            An Array

 

            An ArrayList

            All of the above

 

When a text-box-enter event occurs, which method and parameter are required to handle this type of action? (1 point)

            actionEvent with an actionperformed parameter

            actionPerformed with an actionEvent parameter

 

            actionListener with an interfaceID parameter

            windowListener with an eventID parameter

 

Which class includes the setTitle and setSize methods?

            JWindow

            JBox

 

            JFrame

            JOptionpane

 

Before utilizing the binary search method, __________ must be done to the array?

            sorting

            indexing

 

            splitting

            importing

 

Which layout manager implements a one-compartment layout scheme?

            BorderLayout

            FlowLayout

 

            GridBagLayout

            GridLayout

 

            GridlessLayout

 

What is the default layout manager for a JFrame window?

            BorderLayout

            FlowLayout

 

            GridBagLayout

            GridLayout

 

            GridlessLayout

 

To call the superclass constructor, super() must be the first line in a constructor.

            True

            False

 

Method overriding is when a method has the same name, same sequence of parameter types, and the same return type as a method in a superclass.

            True

            False

 

Type casting, also known as promotion is considered an implicit conversion.

            True

            False

 

An abstract method declaration should always be defined as public as it is meant to be inherited into a subclass to be correctly used.

            True

            False

 

When using parseInt() to convert a string to a number, NumberFormatException is thrown if a non-integer argument is found.

            True

            False

 

enableEdit() is used to allow a user to edit the contents of a JTextField.

            True

            False

 

Write the statement to print to the screen the 6th element of the array defined below?

Declare and initialize an ArrayList of type Double and call this ArrayList stocks.

 

 

 

 

 

Assume that this code fragment compiles and runs. What is its output? As always, be precise when showing your output.

 

Assume that this program compiles and runs. Assume that the user enters 5 6 (separated by a space) for input. What is the output? As always, be precise when showing your output.

 

Assume that this program compiles and runs. Assume that the user enters 5 0 (separated by a space) for input. What is the output? As always, be precise when showing your output.

 

Assume that this program compiles and runs. Assume that the user enters 5 six (separated by a space) for input. What is the output? As always, be precise when showing your output.

import java.util.Scanner;

public class TryCatchQuestion

{

   public static void main(String [] args)

   {

       Scanner stdIn = new Scanner(System.in);

       System.out.println(“Please enter 2 numbers seperated by a space”);

       try

       {

          System.out.println(“Output: ” + stdIn.nextInt() / stdIn.nextInt());

       }

       catch (NumberFormatException e)

       {

          System.out.println(“Number Format Exception”);

       }

       catch (ArithmeticException e)

       {

          System.out.println(“Division by zero”);

       }

       catch (Exception e)

       {

          System.out.println(“Other Exception”);

       }

   }//end main

}//end TryCatchQuestion

 

 

 

Provide code that adds “Hello!” and “Goodbye.” messages to the JFrame window so that the resulting window looks like this:
 

You may assume that the JFrame window has been created using its default layout manager. Provide only two statements – one statement creates “Hello!” and adds it to the window and one statement creates “Goodbye.” and adds it to the window. Do not provide extra code. In particular, you should not provide code for window settings (size, title, etc.), and you should not provide code for a listener. (3 points)

 

Provide the code for a class called Coin.java that implements the main method provided below. 

       }//end main

When the program runs, the following random output should be produced: (numbers will vary as are random)

Program specific requirements:

Style is require but comments are NOT required. 1 pt

Include appropriate import statements for your file. 1 pt

Utilize a constant class array to hold “Heads” and “Tails” 1 pt

Declare a class ArrayList called flips that will hold integer values, 0 for heads and 1 for tails 1 pt

Create a flips method that performs the following: 4

Initializes an instance of the Random class and a random variable

Stores a random variable either 0 or 1

Store the random number in the flips ArrayList

Create a results method that performs the following: 6

Declare variable to hold number of heads flipped

Utilize a for loop to iterate through the ArrayList (do NOT hard code the size here)

For each iteration, increment the result from the ArrayList into a variable called heads

Output the number of Heads using the constant array for the “Heads” heading along with the number of heads flipped

Output the number of Tails using the constant array for the “Tails” heading along with the number of tails calculated from the size of the array minus the number of heads

 

 

 

Prime Paper Help
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.