Please help me debug this code.
* Debug the error(s) and submit to the Dropbox
* Please do not submit if it is not debugged
*
* NOTE: The output should display
*
* 2 to the power 8 is: 256.0
*
*/
public class DebugMeThree {
public static void main(String[] args)
{
double answer = new Math.pow(2, 8);
System.out.println("2 to the power 8 is: " + answer);
}
}
in order to make correct the code only just remove the new keyword form the front of Math.pow(2,8); so debug code is :-
public class DebugMeThree {
public static void main(String[] args) {
double answer = Math.pow(2, 8);
System.out.println("2 to the power 8 is: " + answer);
}
}
Please help me debug this code. * Debug the error(s) and submit to the Dropbox *...
Identify a logical error in the following code and fix it. public class test1 { public static void main(String[] args){ int total; float avg; int a, b, c; a=10; b=5; c=2; total=a+b+c; avg=total/3; System.out.println("Average: "+avg); } } Answer: Write the output of the program below. import java.util.Scanner; public class test2 { public static void main(String[] arg){ int psid; String name; Scanner input=new Scanner(System.in); System.out.println("Enter your PSID"); psid=input.nextInt(); System.out.println("Enter your...
PLEASE HELP DEBUG THE FOLLOWING JAVA PROGRAM // Program displays some facts about a string public class DebugSeven3 { public static void main(String[] args) { String quote = "Honesty is the first chapter in the book of wisdom. - Thomas Jefferson"; System.out.println("index.of('f') is: " + indexOf('f')); System.out.println("index.of('x') is: " + indexOf('x')); System.out.println("char.At(5) is: " + charAt(5)); System.out.println("endsWith(\"daughter\") is: " + quote.endswith("daughter")); System.out.println("endsWith(\"son\") is: " + quote.endswith("son")); System.out.println("replace('e', '*') is: "...
In each of the following questions, first use NetBeans IDE to run the code (if there is an error fix it) then take a screenshot of the output and paste it under (A). In (B), justify the output you obtained in (A). - 9. Given the following: public class WorkingSheet { public static void main(String[] args) { B myB = new B(); A myA = new B(); System.out.print(myB instanceof A); System.out.print(myB instanceof C); System.out.print(myA...
please debug this code:
import java.util.Scanner;
import edhesive.shapes.*;
public class U2_L7_Activity_Three{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
double radius;
double length;
System.out.println("Enter radius:");
double r = scan.nextDouble();
System.out.println("Enter length:");
double l = scan.nextDouble();
System.out.println("Enter sides:");
int s = scan.nextInt();
Circle c = Circle(radius);
p = RegularPolygon(l , s);
System.out.println(c);
System.out.println(p);
}
}
Instructions Debug the code provided in the starter file so it does the following: • creates two Double objects named radius and length creates...
What is the output of the following code? class C1 { public double PI=3.1; public void m1() { System.out.println("M1 of C1"); } } class C2 extends C1 { public double PI=3.14; public void m1() { System.out.println("M1 of C2"); } } public class C { public static void main(String[] args) { C1 obj = new C2(); System.out.print(obj.PI); } } 3.1 3.14 None of the above
Java. What is the output of this code? Ace.java public class Ace { private double a; public Ace ( double x) { a = x; } public void multiply (double f) { a *= x; } public String toString () { return String.format ("%.3f", x); AceDem.java public class AceDemo { public static void main(String args[]) { Ace card = new Ace (2.133); card.multiply (.5); System.out.println (card); } }
What is the output of the following code? class C1 { public double PI=3.1; public void m1() { System.out.println("M1 of C1"); } } class C2 extends C1 { public double PI=3.14; public void m1() { System.out.println("M1 of C2"); } } public class C { public static void main(String[] args) { C1 obj = new C2(); obj.m1(); } } M1 of C1 M1 of C2 None of the above
Why float f = 10d will cause the compiler error/ and why int and double did not cause any compiler error ? public class Main { public static void main(String[] args) { // write your code here char c = 38; int i = 'a'; double d = 10f; double d2 = 10; float f = 10d; System.out.println(a + b); } }
// Debug 10-1 find error in the code and re write it #c // Displays three message boxes using System; using System.Windows.Forms; public class DebugTen1 { publis static void Main() { string caption = "Famous quote"; MessageBox.Show(To be..., caption); caption += " continued"; MessageBox("or not to be...", caption); MessageBox("That is the question", caption) } }
Please code using Java!!! What is Derivation, how a class C is defined as subclass of the class B? a. Complete the code of main to have the output class One{ public One(){ System.out.println("A message from the class One: "); } } class Two extends One { . . . } // Driver class public class Questions { public static void main(String[] args) { Two obj2=new Two(); } } The output: A message from the class One: