Calculator

Calculator - } public static void divide() { int g = 8;...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class Calculator { public static void addition() { int a = 2; int b = 3; int z = a+b; System.out.println("The sum of a and b is "+z); } public static void subtraction() { double c = 4.1; double d = 5.1; double y = c-d; System.out.println("The subtraction of d from c is "+y); } public static void multiply() { int e = 6; int f = 7; int x = e*f; System.out.println("Multiplying e with f results in "+x);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } public static void divide() { int g = 8; double h = 9.1; double w = (double)g/h; System.out.println("Dividing g by h results in "+w); } public static void main(Stringargs) { System.out.println("a=2 b=3 c =4.1 d=5.1 \ne=6 f=7 g=8 h=9.1"); addition(); subtraction(); multiply(); divide(); } }...
View Full Document

Ask a homework question - tutors are online