3) Convert the following to switch-case
int c;
double calc = 0.00d; if (c == 5)
calc = c*25;
if (c == 10)
calc = c*55;
if (c == 15)
calc = c*75;
else calc = c*85; System.out.println(calc);
Answers
Answered by
1
Answer:
import java.util.Scanner;
class calculator
{
public static void main()
{
Scanner in = new Scanner(System.in);
int c = in.nextInt();
double calc = 0.00d;
switch(c)
{
case 5:
calc = c * 25;
break;
case 10:
calc = c * 55;
break;
case 15:
calc = c * 75;
break;
default :
calc = c * 85;
}
System.out.println(calc);
}
}
Answered by
1
Hi dear..................
Similar questions