[英]Why doesn't charon accept my code?
I have just started a computer science degree at university, and I am stuck on a task.我刚刚开始在大学攻读计算机科学学位,我被一项任务困住了。 I am obviously very new to programming so please don't judge, i'm trying to learn the basics, and this exercise is very basic yet i cannot quite solve it.
我显然对编程很陌生,所以请不要判断,我正在尝试学习基础知识,这个练习非常基础,但我无法完全解决它。 I have done many iterations to this code, and when i compile and run it on BlueJ it outputs what is expected, however when i submit it to charon, it responds telling me that the code is wrong.
我对这段代码进行了多次迭代,当我在 BlueJ 上编译并运行它时,它会输出预期的内容,但是当我将它提交给 charon 时,它会回应告诉我代码是错误的。
here is my code;这是我的代码;
class Main extends BIO
{
public static void main( String args[] )
{
System.out.print( "#Enter Student mark: ");
int cw = BIO.getInt();
System.out.print( "#Enter Student mark: ");
int examMark = BIO.getInt();
System.out.print( ("ex = 71 cw = 40 mark = ") );
System.out.println( (double) (cw+examMark) / 2);
}
}
I have attached a screenshot of the exercise below as well for context.我还附上了下面练习的屏幕截图以及上下文。
any help is appreciated thank you.感谢您提供任何帮助。
You need to put in the variables into the print
statement, and not a hardcoded value.您需要将变量放入
print
语句中,而不是硬编码值。
System.out.print("ex = " + examMark + " cw = " + cw + " mark = ");
System.out.println((double) (cw + examMark) / 2);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.