Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please answer and show all work. Thanks! Write a program \"FunWithMath\" which d

ID: 3792863 • Letter: P

Question

Please answer and show all work. Thanks!

Write a program "FunWithMath" which does the following math operations with integers and print the results. Sum of the integers Difference of the integers Product of the integers Complete the following program "MakeSentence" so that it prints the message "the quick brown fox jumps over the lazy dog". public class MakeSentence {public static void main(String[] args) {String animal1 = "quick brown fox"; String animal2 = "lazy dog"; String article = "the"; String action = "jumps over";/* Your work goes here */System.out.println(message);}}

Explanation / Answer

//FunWithMath.java

import java.util.Scanner;
import java.lang.*;

public class FunWithMath
{

public static void main(String[] args)
{

Scanner sc = new Scanner(System.in);
double number1, number2;

System.out.println("Enter number1: ");
number1 = sc.nextDouble();
System.out.println("Enter number2: ");
number2 = sc.nextDouble();

double sum = number1 + number2;
double difference = Math.abs(number1-number2);
double product = number1*number2;

System.out.println("Sum: " + sum);
System.out.println("Difference: " + difference);
System.out.println("Product: " + product);

}

}

/*
Output:

Enter number1:
12
Enter number2:
13
Sum: 25.0
Difference: 1.0
Product: 156.0

*/




//MakeSentence.java

import java.util.Scanner;
import java.lang.*;

public class MakeSentence
{

public static void main(String[] args)
{

String animal1 = "quick brown fox";
String animal2 = "lazy dog";
String article = "the";
String action = "jumps over";

String messsage = article + " " + animal1 + " " + action + " " + animal2;

System.out.println(messsage);

}

}

/*
Output:

the quick brown fox jumps over lazy dog


*/