0
試圖創建一個程序,允許您輸入圖片框和圖片的長度/寬度,然後比較兩者以查看是否適合放入其他圖片。簡單的東西,因爲我是新來的Java,但我離題 - 這裏是代碼:在我的掃描儀上找不到符號
import java.util.Scanner;
public class pictureFrame {
public static void main(String[] args) {
double x = 0;
double y = 0;
double u = 0;
double v = 0;
xScanner = new Scanner(System.in);
yScanner = new Scanner(System.in);
uScanner = new Scanner(System.in);
vScanner = new Scanner(System.in);
System.out.println("Enter the length of the picture");
x = xScanner.nextDouble();
System.out.println("Enter the width of the picture");
y = yScanner.nextDouble();
System.out.println("Enter the length of the frame");
u = uScanner.nextDouble();
System.out.println("Enter the width of the frame");
v = vScanner.nextDouble();
if (x = u && y = v)
{
System.out.println("The frame fits the picture!");
}
else if (x == v && y == u)
{
System.out.println("The frame fits the picture!");
}
else
{
System.out.println("The frame does not fit the picture");
}
}
}
}
而且我得到8個錯誤,都說明他們無法爲每個以下的行中的第一個字符查找符號:
xScanner = new Scanner(System.in);
yScanner = new Scanner(System.in);
uScanner = new Scanner(System.in);
vScanner = new Scanner(System.in);
x = xScanner.nextDouble();
y = yScanner.nextDouble();
u = uScanner.nextDouble();
v = vScanner.nextDouble();
對不起,如果這個問題很愚蠢,我確實使用了搜索功能。