/**
* @(#)mimics.java
*
* mimics application
*
* @author
* @version 1.00 2012/8/16
*/
import java.util.*;
public class mimics {
public static void main(String[] args) {
int first=0;
int second=0;
char ope;
String rate=ope;
Scanner user=new Scanner(System.in);
System.out.println("input first and second number: " + first);
first=user.nextInt();
System.out.println("input first and second number: " + second);
second=user.nextInt();
System.out.println("input operator: " + rate);
rate=user.next();
ope=rate.charAt(0);
switch (ope) {
case 1:
System.out.println("Enter the number one=" + (first+second));
break;
case 2:
System.out.println("Enter the number two=" + (first-second));
break;
case 3:
System.out.println("Enetr the number three="+ (first*second));
break;
case 4:
System.out.println("Enter the number four="+ (first/second));
break;
default:
System.out.println("Invalid Entry!");
}
}
}
ERROR MESSAGE :
incompatible types
I can't figure out why it won't compile.
Page 1 of 11 Replies - 346 Views - Last Post: 16 August 2012 - 05:35 AM
Replies To: I can't figure out why it won't compile.
#2
Re: I can't figure out why it won't compile.
Posted 16 August 2012 - 05:35 AM
Quote
String rate = ope;
Makes no sense. Different types. Delete that line
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|