please write 2 codes, 1 for each description and comment with explanations


Dear Student,
Here i have written the two Java programs for each equation...
NOTE: Please note that the following programs have been tested in an online compiler.
Program:1
-----------------------------------------------------------------------------------------------------------------------------------------
import java.util.Scanner;
public class CollectionTest {
public static void main(String args[])
{
int x = 20;
int y = 10;
//adding two numbers in
Java by calling method
System.out.printf(" Addition
of numbers %d and %d is %d %n", x, y, sum(x,y));
//Multiplying two
numbers in Java by calling method
System.out.printf("
Multiplication of numbers %d and %d is %d %n", x, y,
mul(x,y));
//Division of two
numbers in Java by calling method
System.out.printf(" Division
of numbers %d and %d is %d %n", x, y, div(x,y));
}
public static int sum(int x, int y)
{
return x + y;
}
public static int mul(int x, int y)
{
return x * y;
}
public static int div(int x, int y)
{
return x / y;
}
}
------------------------------------------------------------------------------------------------------------------------------------------
Here i have attached the output of the program as a screen shot...
Output:1:
-------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------
program2:
===============================================================
import java.util.Scanner;
public class CollectionTest {
public static void main(String args[])
{
int x = 0;
int y = 3;
double w = 4.1;
double q = 2.0;
//adding two numbers in
Java by calling method
System.out.printf(" Addition
of numbers %d and %d is %d %n", x, y, sum(x,y));
System.out.printf(" Addition
of numbers %f and %f is %.1f %n", w, q, sum(w,q));
}
public static int sum(int x, int y)
{
return x + y;
}
public static double sum(double w, double
q)
{
return w + q;
}
}
-----------------------------------------------------------------------------------------------------------------------------------
Here i have attached the output of the program as a screen shot...
Output:1:
-------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------
Kindly Check and Verify Thanks....!!!
please write 2 codes, 1 for each description and comment with explanations Lab08 Methods P1. rite...
Write a Java program that has the following methods: findSum - a method that takes in three integers and returns the sum of these three integers; findAverage - a method that takes in three integers and returns the average of these three integers (as a double value) Within the main method read in 3 integers from the user and call above two methods by passing the three integers. Your program should print the user provided three integers and results of...
I need java code for the following problem.
Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that accepts one integer parameter and returns the value raised to the third power as an integer. o Write a method called randominRange that accepts two integer parameters representing a range. The method returns a random integer in the specified range inclusive. 2. o Write a method...
Please Use Python and provide explanations!!!! 1. Write a function called multiply_and_print that takes two numbers, multiplies them together, and prints out the sentence '____ times ____ is ____'. Ask the user for two numbers, and call multiply_and_print with their two numbers as arguments. 2.Write a function called roll_dice that rolls two six-sided dice and prints out the result of each die. Call it three times. (Remember, you can import the random module with the statement import random, and then...
Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: o Write a method called cubeIt that accepts one integer parameter and returns the value raised to the third power as an integer. 2. Write a method called randomInRange that accepts two integer parameters representing a range. The method returns a random integer in the specified range inclusive. o Write a method called larger that accepts two double parameters and...
In
JAVA PLEASE CODE
Problem 2 (71 points) Create methods Create the following two methods for playing a lottery. /"This method returns an ArrayList of Integers. The totalNums parameter tells us how many numbers will fill the ArrayList and the highestNum parameter tells us the max value of the numbers to be held in the ArrayList* ArrayList<Integer> generateNums(int totalNums, int highestNum)
DESCRIPTION: The range of integers that can be represented in Java using a primitive data type is only from-263 to 263-1. What if we need to manipulate integer values beyond this range? In this assignment you will write a HugeInteger class which is able to represent arbitrar- ily large integer numbers. This class must implement arithmetic operations on integers such as addition, subtraction, multiplication, division and comparison. You have to implement this class without using Java predefined classes, unless specified...
1) ALL IN JAVA THANK YOU Design and implement a method that invokes other methods (either predefined in the Java API, or your own helper methods). This is method decomposition. 2) Write or evaluate a comment for a method. Each method should have comments that include its purpose, description of its parameters and return (if any) including data types, and any assumptions.
Write a complete Java program called MethodTest according to the following guidelines. The main method hard-codes three integer values into the first three positions of an array of integers calls a method you write called doubleEachValue that takes an array of integers (the one whose values you hard-coded in main) as its only argument and returns an ArrayList of integers, with each value in returned ArrayList equal to double the correspondingly indexed value in the array that is passed in...
please write this program in C++(Linux). Also write all the
explanation of codes, the comment for your code.
Description You are an avid reader and have decided that you would like to keep track of the books that you read. You will define a structure called book_list that will hold 1. a number associated with each book (int) 2. book title (string), 3. author (string), 4. a description of the book (string), 5. a date when the book was read...
Question 3 (1 point) Question 3) METHODs to our Madness: Use the pseudocode methods below to answer the questions starting on the next page. FIRST METHOD: COMMENT parameters should be integers METHOD largestValue(parameters: num1, num2) BEGIN IF(num1 >= num2) THEN result ← num1 ELSE result ← num2 ENDIF END largestValue SECOND METHOD: COMMENT parameters should be doubles METHOD largestValue(parameters: num1, num2) BEGIN IF(num1 >= num2) THEN result ← num1 ELSE result ← num2 ENDIF RETURN...