1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Kazeer [188]
4 years ago
13

1. JAVA Create one method to do the following expressions. Given the following declarations, what is the result of each of the e

xpressions
int w = 2, y = 7, z = 12;

a. w * z
b. w * z + y
c. w * -z
d. w * --z + y++
e. w * z-- + ++y
f. w + z * y
g. w – y + z
h. (w + y) * z
i. y / w
j. y / z
k. w % y
l. y % w
Computers and Technology
1 answer:
nordsb [41]4 years ago
7 0
<span>public void myMethod(int w, int y, int z) {
</span>int a, b, c, d, e, f, g, h, i, j, k, l;

<span>a = w * z;
</span>b = w * z + y;
c = w * -z;
d = w * --z + y++;
e = w * z-- + ++y<span> ;
</span>f = w + z * y;
g =  w – y + z;
h = (w + y) * z;
i = y / w;
j = y / z;
k = w % y;
<span>l = y % w;
</span>System.out.println( "%d %d %d %d %d %d %d %d %d %d %d %d", a,b,c,d,e,f,g,h,i,j,k);
}

To use 
myMethod(2, 7, 12);
You might be interested in
Class ____________ allow you to create one version of a class, without having to replicate code to handle multiple data types.
nasty-shy [4]

Class <em>t</em><em>e</em><em>m</em><em>p</em><em>l</em><em>a</em><em>t</em><em>e</em><em>s</em> allow you to create one version of a class, without having to replicate code to handle multiple data types.

7 0
2 years ago
Read 2 more answers
Circle class
NISA [10]

Answer:

What was the actual the question? I am confused.

Explanation:

4 0
3 years ago
Can java scanner not take in a negative input?
algol [13]

Answer:

It can take a negative input

Explanation:

When you declare a variable in Java and you get your input via Scanner library; the Scanner library will accept the input irrespective of whether it's negative or not.

Take for instance, the following segment

<em>Scanner input = new Scanner(System.in);</em>

<em>int userinput = input.nextInt()</em>

<em />

Irrespective of whether userinput is negative or positive, it'll accept it.

8 0
3 years ago
What kind of waste does a computer generate?<br><br> Will give brainly :3
Lena [83]

Answer:

waste???? a computer??

7 0
3 years ago
I’m failing this class and i’m stuck on this one, this is the code from the last lesson:
serg [7]

lst=([])

def avgGPA(lst1):

   total = 0

   count = 0

   for x in lst:

       if type(x) == int:

           total += x

           count += 1

   return total/count

def GPAcalc(grade, weighted):

   grade = grade.lower()

   dictionary = {"a": 4, "b": 3, "c": 2, "d": 1, "f": 0}

   if weighted == 1 and grade in dictionary:

       lst.append(dictionary[grade]+1)

       return "Your GPA score is: " + str(dictionary[grade] + 1)

   elif weighted == 0 and grade in dictionary:

       lst.append(dictionary[grade])

       return "Your GPA score is: " + str(dictionary[grade])

   else:

       lst.append("Invalid")

       return "Invalid"

classes = int(input("How many Classes are you taking? "))

i = 0

while i < classes:

   print(GPAcalc(input("Enter your Letter Grade: "), int(input("Is it weighted? (1 = yes) "))))

   i += 1

print("Your weighted GPA is a "+str(avgGPA(lst)))

If you need me to change any code, I'll do my best. I hope this helps!

6 0
3 years ago
Other questions:
  • Yeah i just purchase a new laptop with built-in 802.11 wireless and bluetooth capabilities when you boot into windows you do not
    12·1 answer
  • The term _____ refers to an organization of components that define and regulate the collection, storage, management and use of d
    7·2 answers
  • If the value of the expression,
    13·1 answer
  • Which of the following statements will assign the contents of the Text property of a Textbox control named txtInput into the Tex
    10·1 answer
  • Define a function below called increase_elements_by_x, which takes two arguments - a list of numbers and a single positive numbe
    13·1 answer
  • In order to install a device, the operating system needs the required __________ for that device.
    15·2 answers
  • . Suppose that name is a variable of type string. Write the input statement to read and store the input Brenda Clinton in name
    5·1 answer
  • Chris is a project manager. He would like to schedule a status meeting for the next week. Several of the group members work at a
    12·1 answer
  • What are three types of audio editing techniques?
    8·2 answers
  • Please say me the answer fast its really urgent........ ​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!