我正在使用BlueJ。我的任务是完成方法“zool”,然后完成方法“printAmerican”和“printEuropean”。然后,完成主要方法调用其他三个;但是,我得到了这些错误:
使用-Xdiags重新编译:详细以获得完整的输出 不兼容的类型 - 无法将此行的String转换为int:
Tap gesture recognizer
以下是所有代码:
printAmerican ("enter day of the week","enter month", "enter date", "enter year");
答案 0 :(得分:0)
您的代码存在一些问题,例如:
printAmerican()
接受参数String, String, int, int
,但您使用String, String, String, String
printEuropean()
System.out.println(printAmerican);
没有意义 - printAmerican
是方法的名称,您无法使用println()
打印它zool()
除了a = ("Distance")
b = ("Time")
c = ("Volume")
d = ("Temp")
e = ("Weight")
def conversion_type(first):
if first == ("Distance"):
ini = input("How great a distance am I converting?\n")
elif first == ("Time"):
ini = input("How much time am I converting?\n")
elif first == ("Volume"):
ini = input("How great a volume am I converting?\n")
elif first == ("Temp"):
ini = input("How many degrees am I converting?\n")
elif first == ("Weight"):
ini = input("How much weight am I converting?\n")
else:
print("That not was an afformentioned dimension you dolt.")
def variable_type_converter(ini):
ini = float(ini)
print ("\n Welcome to the Convert-O-Matic\n==============================\n")
print ("I support the following dimensions:\n")
print ("%s, %s, %s, %s, and %s," % (a,b,c,d,e))
first = input("What kind of conversion would you like to do?\n")
conversion_type(first)
variable_type_converter(ini)
print("==========================================")
,如果删除了变量赋值,它会做评论所说的内容)请查看您为此作业提供的任何材料,并询问您是否对某些问题有特定问题。