
-
Create a Java program that declares and initializes two integer variables, "num1" and "num2", with values of your choice
-
Output the values of "num1" and "num2" to the console using the System.out.println() method.
-
Use the addition operator (+) to add "num1" and "num2" together and output the result to the console.
-
Use the subtraction operator (-) to subtract "num2" from "num1" and output the result to the console.
-
Use the multiplication operator (*) to multiply "num1" and "num2" together and output the result to the console.
-
Use the division operator (/) to divide "num1" by "num2" and output the result to the console.
-
Use the modulus operator (%) to find the remainder when "num1" is divided by "num2" and output the result to the console.
-
Use the increment operator (++) to increment the value of "num1" by 1 and output the new value to the console.
-
Use the decrement operator (--) to decrement the value of "num2" by 1 and output the new value to the console.

Step by stepSolved in 3 steps with 1 images

- Given sphereRadius, compute the volume of a sphere and assign sphereVolume with the result. Use (4.0 / 3.0) to perform floating-point division, instead of (4 / 3) which performs integer division.Volume of sphere = (4.0 / 3.0) π r3 (Hint: r3 can be computed using *. Use the constant Math.PI for the value of pi.) New JAVA code can only be added between lines 10 and 12.arrow_forwardProgram63.javaWrite a program that estimates the cost of carpet for one or more rooms with rectangular floors. Begin by prompting for the price of carpet per square yard and the number of rooms needing this carpet. Use a loop to prompt for the floor dimensions of each room in feet. In this loop, call a value-returning method with the dimensions and carpet price as arguments. The method should return the carpet cost for each room to main, where it will be printed and accumulated. After all rooms have been processed, the program should display the total cost of the job.Sample Output (image below) Program64.javaWrite a program that demonstrates method overloading by defining and calling methods that return the area of a triangle, a rectangle, or a square.arrow_forwardPlease try to explain how to do it. Please in java file. Loops is the topic.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





