|
|
|
Posts: 17,781
Country:
Star Sign:
Join Date: Jul 2010
Location: ▌║█║▌│█│║▌║
Gender:
|
|
Quote:
Originally Posted by AYAZ
Morash check this code, It's giving me error don't know why
Code:
package cal;
import java.util.Scanner;
/**
*
* @author Ayaz
*/
public class cal
{
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
float num1 , num2;
String operations;
Scanner input = new Scanner (System.in);
System.out.print("Enter the First number");
num1 = input.nextFloat();
System.out.print("Enter the operation");
operations = input.next();
System.out.print("Enter the Second Number");
num2= input.nextFloat();
switch (operations){
case "+":
System.out.print("Addition of "+num1+"and "+num2+" is = "+ (num1 + num2));
break;
case "-":
System.out.print("Substraction of "+num1+"and "+num2+" is = "+ (num1 - num2));
break;
case "/":
System.out.print ("Division of "+num1+" and "+num2+" is" = + (num1 / num2));
break;
case "*":
System.out.print("Multiplication of "+num1+" and "+num2+" is" = + (num1 * num2));
break;
}
}}
|
Your Package And Cal Class Names Are Same, Change cal Class Name To Cal (Capital C)
Last 2 Jo System.out.print K Statements Hai Os Mai is K Saath Jo Double Commas Lage Hai, Wo Remove Karo And Equal Sign K Baad Lagana ..
➳ bE driveN wiTh puRpOse, Be r313n71355 in your alιgnмenт;
with excellence.
pAy n0 mInd to the ∂ιsιмραssισηε∂ เ๓ק๏tєภt ђคtєгร ♬
☣ .. нoolιgan ☠
|