[solved] – Question 8510

write a java application to calculate the exponent value of a number using the following specifications:
.prompt the user to enter an interger value
.pass the interger value to the method square, which squares the number and to a method cubes the number. The result must be returned to the main method.
The main method must print the results along with a suitable message

Expert Answer


[solved] – Question 85137

Write a program that computes the results of integer and floating-point division, where variables a, and b are declared as integers, c and d are declared as floating-point numbers, and all are user-specified.

Integer division is defined as whole-number division. For example, 1/2 (as integers) = 0. Whereas, if we specified 1/2 (as “floats”; i.e., floating-point numbers), the result is 0.5. In C++, the result of an arithmetic operation (e.g., whether the computer computes the result as an integer or as a float) is specified by the data type.
Your task is to make edits within main such that, when run, the program produces the following console output:
Enter two integers: [user-specified value for a] [user-specified value for b]
Integer division: [a]/[b] = [a]/[b]
Floating-point division: [c]/[d] = [c]/[d]
Mixed-type division: [a]/[d] = [a]/[d]
Mixed-type division: [c]/[b] = [c]/[b]

Expert Answer


[solved] – Question 85157

Write a function matched(s) that takes as input a string s and checks if the brackets “(” and “)” in s are matched: that is, every “(” has a matching “)” after it and every “)” has a matching “(” before it. Your function should ignore all other symbols that appear in s. Your function should return True if s has matched brackets and False if it does not.

Hint: Keep track of the nesting depth of brackets. Initially the depth is 0. The depth increases with each opening bracket and decreases with each closing bracket. What are the constraints on the value of the nesting depth for all brackets to be matched?

Here are some examples to show how your function should work.

>>> matched(“zb%78”)
True

>>> matched(“(7)(a”)
False

>>> matched(“a)*(?”)
False

>>> matched(“((jkl)78(A)&l(8(dd(FJI:),):)?)”)
True

Expert Answer


[solved] – Question 85187

Write a program that uses two input statements to get two words as input. Then, print the words on one line separated by a space.

Expert Answer


[solved] – Question 85190

Write a program to output the following:

**********
* *
* PYTHON *
* *
**********

Expert Answer


[solved] – Question 85191

Write a program to output the following:

**********
* *
* PYTHON *
* *
**********

Expert Answer


[solved] – Question 85194

1. Write a complete Main method that prints Hello, world to the screen.

2. Suppose your name was George Gershwin. Write a complete main method that would print your last name, followed by a comma, followed by a space and your first name.
3. Write an expression that attempts to read a double value from the TextBox textBox and stores it in a Double variable, x, that has already been declared.

Expert Answer


[solved] – Question 85284

1.Prove that n + log n = O(n) by showing that there exists a constant c > 0 such that n + log n ≤ cn.

Expert Answer


[solved] – Question 85285

Prove that n + log2n = O(n) by showing that there exists a constant c > 0 such that n + log2n ≤ cn.
(note that log2n means (log n)2.)

Expert Answer


[solved] – Question 85286

Prove the following using mathematical induction:
1. (ab)n = an bnfor every natural number n
2.13 +23+33+…+n3 = (1+2+3+…+n)2
3.1+3+5+7+…+(2n-1) = n2

Expert Answer