In: Computer Science

- Write a Calculate class which contains methods that accepts two integers as arguments and return the results of Addition, Subtraction, Division and Multiplication. Call these methods though main()and print the results.

**JAVA CODE :**

import java.util.*;

public class Calculate

{

public static void Addition(int a, int b) // addtion

{

System.out.println("Addition : " + (a + b));

}

public static void Subtraction(int a, int b) // subtraction

{

System.out.println("Subtraction : " + (a - b));

}

public static void Multiplication(int a, int b) //
Multiplication

{

System.out.println("Multiplication : " + (a * b));

}

public static void Division(int a, int b) // Division

{

System.out.println("Division : " + (a / b));

}

public static void main(String[] args) {

Scanner s = new
Scanner(System.in);

System.out.print("Enter the value
of a and b : ");

int a = s.nextInt(); // read
a

int b = s.nextInt(); // read
b

Addition(a, b);

Subtraction(a, b);

Multiplication(a, b);

Division(a, b);

}

}

**OUTPUT :**

in C++In this third part, write a function that accepts an array of
integers and its size as arguments. The function should create a
new array that is of half size the argument array (round up the
fraction if the size of the argument array is odd). The value of
the first element (Element 0) of the new array should be the sum of
the first two elements of the argument array (Element 0 and 1).
Element 1 of the...

Write a simple java class that contains the following three
methods:
1. isosceles -- accepts 3 integers which represent the sides of
a triangle. Returns true if the triangle is isosceles and false
otherwise.
2. perimeter - accepts 3 integers that represent the sides of a
triangle and returns the perimeter of the triangle.
3. area -- accepts 3 integers, which represent the sides of a
triangle and calculates and returns the area of the triangle. Hint:
use Heron's formula....

In a program, write a function that accepts two arguments: a
list, and a number n. Assume
that the list contains numbers. The function should display all
of the numbers in the list that
are greater than the number n.
The program should ask for a list of numbers from the user as
well as a value (a, b, c)--> inputs from user. After that, each
number in that list should be compared to that value (a or b or...

6-Write a module in pseudocode called magicSix(), which
accepts two integers and displays a message “Magic 6!” if either of
the two integers is a 6 or if their sum or difference is a 6.
Otherwise, the program will display “Not a magic 6.” Note, you will
need to determine the larger number when calculating the
difference, to get a positive difference. You cannot use any
built-in Python functions to do this. Type your pseudocode into
your answer document.
7-...

Write a function that accepts two arguments (say a and b) by
value and one argument (say c) by reference. Then it calculates the
multiplication of all the numbers between a and b (inclusive) and
saves the results in c. The function does not return any value.

specifications for Tasks:
1. Write a program which accepts a list of integers which may
contain duplicated integers, and which outputs the input list as a
sorted list in ascending order without duplication You can use
either Ruby, C, C++, C# or Java to implement your program (referred
to as P).
2. Design a test suite of 10 test cases (referred to as TC).
Each test case has not more than 20 integers.
3. Test P against TC to make...

Write methods contains and remove for the BinarySearchTree
class. Use methods find and delete to do the work

Write a function that accepts an int array and the array's size as arguments. The function should create a copy of the array, except that the element values should be reversed int the copy. The function should return a pointer to the new array. Demonstrate the function in a complete program.

Using Python
#Write a function called after_second that accepts two
#arguments: a target string to search, and string to search
#for. The function should return everything in the first
#string *after* the *second* occurrence of the search term.
#You can assume there will always be at least two
#occurrences of the search term in the first string.
#
#For example:
# after_second("11223344554321", "3") -> 44554321
#
#The search term "3" appears at indices 4 and 5. So, this
#returns everything...

java Problem 3: An Interesting Problem
Write a program that accepts two positive integers: a deposited
amount of money and an
interest rate, as an annual percentage rate. Your program will
calculate the number of years that
will take for the account balance to reach $1, 000,000. You can
assume that the initial deposit is
less than $1,000,000
Input
The input will begin with a single line containing T , the number
of test cases to follow. The
remaining lines...

ADVERTISEMENT

ADVERTISEMENT

Latest Questions

- william brown is 30 years and wants to retire when he is 65. so far he...
- 1. List and elaborate on the reasons that there more singles today than ever before. 2....
- During December of the current year, Teletex Systems, Inc., a company based in Seattle, Washington, entered...
- Which FTP command allows you to retrieve a file from within an FTP session? 39. Company...
- When would a sequential colormap work well in a heatmap? Select an answer: when you want...
- Write a synopsis about the CPU in 300 words
- C++ program Dairy Farm decided to ship milk in containers in the form of cubes rather...

ADVERTISEMENT