Question: public class SelectionSwitch { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System.in ) ; System.out.println

public class SelectionSwitch {
public static void main(String[] args){
Scanner sc = new Scanner(
System.in);
System.out.println("Enter an expression: ");
double v1= sc.nextDouble () ;
char op = sc. next()*charAt();
double v2= sc.nextDouble () ;
System.out.println("Your expression is: "+ v1+""+ op +""+ v2);
switch(op){
case '+' :
System, out.println(v1+"+"+v2+=+(v1+v2);
break;
case '-' :
System.out.println(v1+""+ v2+"="+(v1-v2));
break;
case '**' :
System.out.println(v1+"*+v2+=+(v1**v2);
break;
case '??' :
System. out.println(v1+"/+ v2+"="+(v1/v2));
break;
default:
System.out.println("Invalid operation!");
}
}.
}
 public class SelectionSwitch { public static void main(String[] args){ Scanner sc

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!