我正在學習如何使用Java和我的課程作業我被要求構建一個應用程序,該應用程序將讀取考試標誌和課程標記,然後打印出來課程作業和考試分數的平均值爲1位小數。當我將它提交給課程作業提交系統時,它說這是不正確的。計算兩個整數的平均值並將其轉換爲java中的雙精度值
答案,它的要求是,我的代碼產生了答案(例如= 71 CW =40馬克= 55.5) 但由於某些原因,它說這個時,我提交:
-#### << Differences between expected (<) your answer (>) >> ------------
1c1
< ex= 91 cw = 80 mark = 85.5
---
> ex = 71 cw = 40 mark = 55.5
-------------------------------------------------------------------------
[S] Sorry exercise ci101/1.2 was not correct.
Check the above output for why this attempt failed
當我將ex改爲91,cw改爲80,它再次要求> ex = 71 cw = 40 mark = 55.5。
class Main
{
public static void main(String args[])
{
int ExamMark=71;
int CourseworkMark=40;
double cost = (double)(ExamMark + CourseworkMark)/2;
System.out.printf("ex = " + ExamMark + " cw = " + CourseworkMark + " mark = " + cost);
System.out.println();
}
}
檢查你的輸出的間距,確保它完全匹配 – brso05 2014-10-31 13:59:48