Question

This question relates to java, In this assignment, we have to create our append java void...

This question relates to java,

In this assignment, we have to create our append java void method and inside the parameter is double value. I know append is when element is being add to the end of the length-1. I don't know if you have to create a list object? Could really use help

0 0
Add a comment Improve this question Transcribed image text
Answer #1

package javaapplication2;
import java.util.ArrayList;

public class JavaApplication2 {
    private static ArrayList<Double> arraylist= new ArrayList<Double>();

    public static void main(String[] args) {
        JavaApplication2 ja = new JavaApplication2();
        for (int i = 1; i <= 10; i++) {
            ja.append(i);
        }
        System.out.println("Value of arraylist "+arraylist);
    }

    private void append(double val) {
        arraylist.add(val);
    }
}

Add a comment
Know the answer?
Add Answer to:
This question relates to java, In this assignment, we have to create our append java void...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA - Circular Doubly Linked List Does anybody could help me with this method below(previous)? public...

    JAVA - Circular Doubly Linked List Does anybody could help me with this method below(previous)? public E previous() { // Returns the previous Element return null; } Explanation: We have this class with these two implemented inferfaces: The interfaces are: package edu.ics211.h04; /** * Interface for a List211. * * @author Cam Moore * @param the generic type of the Lists. */ public interface IList211 { /** * Gets the item at the given index. * @param index the index....

  • This is a java assignment Please help me Write the body of the fileAverage() method. Have...

    This is a java assignment Please help me Write the body of the fileAverage() method. Have it open the file specified by the parameter, read in all of the floating point numbers in the file and return their average (rounded to 1 decimal place). For the testing system to work, don't change the class name nor the method name. Additionally, the file will have different contents during testing. public class Main { public double fileAverage( String filename ){    }...

  • JAVA SOLUTION This lab has four parts: Create a window. Create 5 buttons in that window....

    JAVA SOLUTION This lab has four parts: Create a window. Create 5 buttons in that window. Create an event when a button is pushed. Create an event listener that will respond to the button being pushed event. Task 1 – Create a Window For Java: Please ensure that the following import statements are used: import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.GridPane; import javafx.scene.text.Text; import javafx.event.EventHandler; import javafx.scene.input.MouseEvent; Next, ensure that there is a main method which is...

  • Create a method for a singlyLinked class public void remove( ) removes a randomly selected entry...

    Create a method for a singlyLinked class public void remove( ) removes a randomly selected entry from the bag I don't know how to make it random I just know how to remove the first on the list this is what I have /** * * @return Removes and returns the first node of the bag */ @Override public E remove() { if(bagHead == null) { return null; } E element = bagHead.getElement(); bagHead = bagHead.getNext(); count--; return element; }...

  • Create a method for a singlyLinked class public void remove( ) removes a randomly selected entry from the bag I don...

    Create a method for a singlyLinked class public void remove( ) removes a randomly selected entry from the bag I don't know how to make it random I just know how to remove the first on the list this is what I have /** * * @return Removes and returns the first node of the bag */ @Override public E remove() { if(bagHead == null) { return null; } E element = bagHead.getElement(); bagHead = bagHead.getNext(); count--; return element; }...

  • In JAVA While out on a standard run we stop in at our ‘local’ fence and...

    In JAVA While out on a standard run we stop in at our ‘local’ fence and try to sell some of our items. When we board his ship we notice that we are the only people on board, so we instantly start grabbing things and loading them on our ship and get ready to run. While grabbing things we realize that we are going to run out of space extremely quickly and we should prioritize what we grab to maximize...

  • Hello, In need of help with this Java pa homework. Thank you! 2. Create a normal...

    Hello, In need of help with this Java pa homework. Thank you! 2. Create a normal (POJo, JavaBean) class to represent, i. e. model, varieties of green beans (also known as string beans or snap beans). Following the steps shown in "Assignment: Tutorial on Creating Classes in IntelliJ", create the class in a file of its own in the same package as class Main. Name the class an appropriate name. The class must have (a) private field variables of appropriate...

  • please be thorough with explanations. thank you Question 2 Consider the implementation we made in class...

    please be thorough with explanations. thank you Question 2 Consider the implementation we made in class for ArrayList, and its extensions you did in the lab. In this question, we will add two more methods to this class: the insert method and the pop method. For this question, please submit the modified ArrayList class. a) Implement the method insert (self, index, val) that inserts val before index (shifting the elements to make room for val). For example, your implementation should...

  • Java homework Imagine that you have a Point class, like the one that we used in...

    Java homework Imagine that you have a Point class, like the one that we used in the improved Circle class. It has the following constructors:    Point(double x, double y)    Point(Point p) And the following methods:    public double getX()    public double getY()    public void setX(double xValue)    public void setY(double yValue)    public double distance(Point p) For this question, write statements that create an array of three Point references. Then initialize each element with a Point object that has with x and...

  • This question is about java program. Please show the output and the detail code and comment.And...

    This question is about java program. Please show the output and the detail code and comment.And the output (the test mthod )must be all the true! Thank you! And the question is contain 7 parts: Question 1 Create a Shape class with the following UML specification: (All the UML "-" means private and "+" means public) +------------------------------------+ | Shape | +------------------------------------+ | - x: double | | - y: double | +------------------------------------+ | + Shape(double x, double y) | |...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT