Question

Java code please. Please help

* 95: Write a public class named TollInts with the following. * -A public constructor that takes 2 doubles as inputs. * -A public method named compute that takes no parameters and returns the the tangent of the * first constructor input subtracted by the the square root of the second constructor input * as a double. You will need to store the constructor input in instance variables to be able * to access them in the compute method */

0 0
Add a comment Improve this question Transcribed image text
Answer #1
public class TollInts {


    private double first, second;

    public TollInts(double first, double second) {
        this.first = first;
        this.second = second;
    }

    public double compute() {
        return Math.tan(first) - Math.sqrt(second);
    }

}

Please\;let\;me\;know\;if\;you\;need\;me\;to\;change\;anything\\ Please\;upvote\;this\;answer!

Add a comment
Know the answer?
Add Answer to:
Java code please. Please help * 95: Write a public class named TollInts with the following....
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
  • q2: Write a public class named MythMouseListener that implements the Mouselistener interface. This class will have...

    q2: Write a public class named MythMouseListener that implements the Mouselistener interface. This class will have a public constructor that takes a JTextArea and a JLabel as parameters and stores these in instance variables. Override the mouseEntered method to . display the text from the JTextArea on the JLabel in all upper case letters. Then, override the mouseReleased method to display the text from the JTextArea on the JLabel in all lower case letters. The other three methods from the...

  • Create the header file named “Complex.h” that contains the following class: The class Complex represents a...

    Create the header file named “Complex.h” that contains the following class: The class Complex represents a complex number which is a number of the form a + bi where a and b are real numbers and i2 = −1. The class should contain: Private double field named real. Private double field named imaginary. Public default constructor that assigns 1 to real and 0 to imaginary. Public overloaded constructor that takes a double as a parameter named real. It assigns real...

  • *Java* Create a public static method named maxRes that takes an ArrayList of type Double and...

    *Java* Create a public static method named maxRes that takes an ArrayList of type Double and returns a double. This method returns the maximum result (do not return the original value) of taking the tangent of each value from the input

  • Java - Object Oriented Programming Declare a class named Customer that has two private fields? Write...

    Java - Object Oriented Programming Declare a class named Customer that has two private fields? Write a set method to make sure that if age > 125 years or less than 0 then it is set to 0 (default value) What does it indicate when declaring a class's instance variables with private access modifier? What is the role of a constructor? The data part of by an object's instance variables is known as? Do all methods have to always return...

  • Java Write a class named CheckingAccount containing: An instance variable named balance of type double, initialized...

    Java Write a class named CheckingAccount containing: An instance variable named balance of type double, initialized to 0. A method named deposit that accepts a parameter of type double. The value of the balance instance variable is increased by the value of the parameter. A method named withdraw that accepts a parameter of type double. The value of the balance instance variable is decreased by the value of the parameter. A method named getBalance that accepts no parameters, returns the...

  • ****Here is the assignment **** Purpose: To write an Object-Oriented application that creates a Java class...

    ****Here is the assignment **** Purpose: To write an Object-Oriented application that creates a Java class with several instance variables, a constructor to initialize the instance variables, several methods to access and update the instance variables’ values, along with other methods to perform calculations. Also, write a test class that instantiates the first class and tests the class’s constructor and methods. Details: Create a class called Rectangle containing the following: Two instance variables, An instance variable of type double used...

  • IN JAVA PLEASE Lab 28.1 Add a class named Purchase with: an instance (String) variable for...

    IN JAVA PLEASE Lab 28.1 Add a class named Purchase with: an instance (String) variable for the customer's name an instance (double) variable for the customer's balance a member method public String toString() that returns the object's instance variable data as a single String; e.g., Cathy has a balance of $100.00 Lab 28.2 Add a main class named Store; . Then, add code that: declares and creates an ArrayList of Purchase objects named purchases (make sure to add import java.util.ArrayList...

  • please write in Java and include the two classes Design a class named Fan (Fan.java) to...

    please write in Java and include the two classes Design a class named Fan (Fan.java) to represent a fan. The class contains: An int field named speed that specifies the speed of the fan. A boolean field named fanStatus that specifies whether the fan is on (default false). A double field named radius that specifies the radius of the fan (default 5). A string field named color that specifies the color of the fan (default blue). A no-arg (default) constructor...

  • Can you please check this code and see if its correct An accessor method named getAmount...

    Can you please check this code and see if its correct An accessor method named getAmount that has no explicit parameters and returns the double value of the instance variable expenseAmount.   Here is my code below. public double getAmount () {     return this.expenseAmount; }

  • Room Class....... in JAVA!!!!! Write a class named Room that has the following fields: Length: Double...

    Room Class....... in JAVA!!!!! Write a class named Room that has the following fields: Length: Double variable that holds the rooms length(in feet). Breadth: The double variable that holds the rooms breadth(in feet). Height: Double variable that holds rooms height in feet. Color: String object that holds the color you want the room to be painted with. The class should have a constructor to initialize the fields for a particular instance (or object) of the class as given: All double...

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