Java programming
double d = Math.PI( ); // line 10
System.out.println ( "d = " + d ); // line 11
When I compile,
Test.java:10: error : cannot find symbol
double d = Math.PI( ); // line 10
symbol: method PI( )
location: Class Math
1 error
Explain what the problem is and how to fix
import java.lang.Math.*;
public class Main
{
public static void main(String[] args) {
double d = Math.PI; // line
10
System.out.println ( "d = " + d ); // line 11
}
}
You have kept "( )" after the PI .It should be only Math.PI.Remove those ou will get the answer

Java programming double d = Math.PI( ); // line 10 System.out.println ( "d = " +...
what are the debuggers in Java? import java.text.NumberFormat; /** * * This class represents a circle that would be used as part * of a larger geometry application */ public class Circle { private double radius; private NumberFormat numberFormat; /** * Constructor for the Circle. * @param radius for the circle */ public Circle(double r) { radius = r; } /** * This method uses the radius of the circle to compute...
and the langue is java, thx.
We want to be able to run the following lines of code: ArrayList<Pokemon> party = new ArrayLis party.add(new Pikachu (); // Ash Ketch party.add(new Caterpie(); // Ash Ketch We have already defined the following abstract class: abstract class Pokemon { // abstract method public abstract void makeNoise(); // instance method public void makeSleepNoise() { System.out.println("Zzz"); However, our code won't compile, and we don't know what's wrong. TASK: Fix the bug(s) in our code. Details...
Java Programming Language: Find the compiling error in the following code segment. Explain what the problem is and how to fix it. public class Mark { private float value; public float Mark(float startValue) { value = startValue; } }
Hello, I'm very new to programming and I'm running into a problem with the system.out.println function in the TestAccount Class pasted below. Account Class: import java.util.Date; public class Account { private int accountId; private double accountBalance, annualInterestRate; private Date dateCreated; public Account(int id, double balance) { id = accountId; balance = accountBalance; dateCreated = new Date(); } public Account() { dateCreated = new Date(); } public int getId() { return...
Please help me answer these questions in java programming language. Please answer it line after line so that I can understand please. Does it compile or not? No programming is done in this exercise, simply answer the questions asked in the code given below. class Exemple { /*Explain why this code does not compile */ public void m1() { foo(); } public int foo() throws Exception { throw new Exception(); } /*Explain why this code is not considered as good...
public static void main(String[] args) { System.out.println("Welcome to the Future Value Calculator\n"); Scanner sc = new Scanner(System.in); String choice = "y"; while (choice.equalsIgnoreCase("y")) { // get the input from the user System.out.println("DATA ENTRY"); double monthlyInvestment = getDoubleWithinRange(sc, "Enter monthly investment: ", 0, 1000); double interestRate = getDoubleWithinRange(sc, "Enter yearly interest rate: ", 0, 30); int years = getIntWithinRange(sc, "Enter number of years: ", 0, 100); System.out.println(); ...
(20 pts) Fill in the missing code: This recursive method returns “even” if the length of a give String is even, and “odd” if the length of the String is odd. public static String foo(String s) { if (s.length() ==0) return “even”; else if (s.length() = = 1) return “odd”; else //your code goes here } (40 pts) You coded the following in the file Test.java : System.out.println( foo(5)); //more code here public static int foo(int n)...
Write a java class definition for a circle object. The object should be capable of setting radius, and computing its area and circumference. Use this to create two Circle objects with radius 10 and 40.5, respectively. Print their areas and circumference. Here is the Java class file (Circle.java). Compile it. public class Circle{ //Instance Variables private double PI = 3.1459; private double radius; //Methods public Circle ( ) { } //get method (Accessor Methods ) public double getRadius (...
Java please answer A to I please dont type the answer on
paper please use the computer
A. Explain why alpha cannot be accessed by other
members of its class.
B. In the program, how can you determine the type of
access modifier?
C. Describe the differences and similarities of beta
and gamma in program, within the context of access specifiers and
class member accessibility.
D. Explain how objects, a and b, are passed to the
method.
E. Why...
JAVA Programming
Produce a method that reads in a set of values (double) from the
user and returns them. Use this header:
public static double[] getNumsFromUser(String msg1,
String msg2)
The implementation of the method should start with a message to
input the total number of array elements, followed by a message to
enter all the array elements. The method returns the array of
elements. The two strings msg1 and msg2 that are passed to the
method as parameters will be...