In this lab, you complete a partially written Java program that includes methods that require multiple parameters (arguments). The program prompts the user for two numeric values. Both values should be passed to methods named calculateSum(), calculateDifference(), and calculateProduct(). The methods compute the sum of the two values, the difference between the two values, and the product of the two values. Each method should perform the appropriate computation and display the results. The source code file provided for this lab includes the variable declarations and the input statements. Comments are included in the file to help you write the remainder of the program. My code: import java.util.Scanner; public class Computation {    public static void main(String args[])     {       double value1;       String value1String;       double value2;                       String value2String;        Scanner input = new Scanner(System.in);                 System.out.println("Enter the first numeric value: ");       value1String = input.nextLine();       value1 = Double.parseDouble(value1String);       System.out.println("Enter second numeric value: ");       value2String = input.nextLine();       value2 = Double.parseDouble(value2String);               // Call calculateSum() here       System.out.println(calculateSum(value1,value2));       // Call calculateDifference() here       System.out.println(calculateDifference(value1,value2));       // Call calculateProduct() here       System.out.println(calculateProduct(value1,value2));       System.exit(0);    } // End of main() method.            // Write calculateSum() method here. public static double calculateSum(double a,double b){        return a + b;    }    // Write calculateDifference() method here. public static double calculateDifference(double a,double b){     return a - b;     }    // Write calculateProduct() method here. public static double calculateSum(double a,double b){     return a*b;    } } // End of Computation class.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I already written a code but this error keeps on showing up, I don't know what's wrong with it. Programming language used is Java. If my code is messy, please debug it. Thank you.

Problem:

In this lab, you complete a partially written Java program that includes methods that require multiple parameters (arguments). The program prompts the user for two numeric values. Both values should be passed to methods named calculateSum(), calculateDifference(), and calculateProduct(). The methods compute the sum of the two values, the difference between the two values, and the product of the two values. Each method should perform the appropriate computation and display the results. The source code file provided for this lab includes the variable declarations and the input statements. Comments are included in the file to help you write the remainder of the program.

My code:


import java.util.Scanner;

public class Computation
{
   public static void main(String args[]) 
   {
      double value1;
      String value1String;
      double value2;                
      String value2String; 
      Scanner input = new Scanner(System.in);
         
      System.out.println("Enter the first numeric value: ");
      value1String = input.nextLine();
      value1 = Double.parseDouble(value1String);
      System.out.println("Enter second numeric value: ");
      value2String = input.nextLine();
      value2 = Double.parseDouble(value2String); 
      
      // Call calculateSum() here
      System.out.println(calculateSum(value1,value2));
      // Call calculateDifference() here
      System.out.println(calculateDifference(value1,value2));
      // Call calculateProduct() here
      System.out.println(calculateProduct(value1,value2));
      System.exit(0);

   } // End of main() method.
   
   
   // Write calculateSum() method here.
public static double calculateSum(double a,double b){
       return a + b;
   }

   // Write calculateDifference() method here.
public static double calculateDifference(double a,double b){
    return a - b;
   
}
   // Write calculateProduct() method here.
public static double calculateSum(double a,double b){
    return a*b;
  
}


} // End of Computation class.
>- Terminal
+
Computation.java:46: error: method calculateSum(double, double) is
already defined in class Computation
public static double calculateSum(double a, double b){
Computation.java:29: error: cannot find symbol
System.out.println(calculateProduct(valuel,value2));
method calculateProduct(double,double)
symbol:
location: class Computation
2 errors
Error: Could not find or load main class Computation
Transcribed Image Text:>- Terminal + Computation.java:46: error: method calculateSum(double, double) is already defined in class Computation public static double calculateSum(double a, double b){ Computation.java:29: error: cannot find symbol System.out.println(calculateProduct(valuel,value2)); method calculateProduct(double,double) symbol: location: class Computation 2 errors Error: Could not find or load main class Computation
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Function Calling
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education