Student Score Management System


Submit solution

Points: 10 (partial)
Time limit: 1.0s
Memory limit: 64M

Authors:
Problem type
Allowed languages
Java 19, Java 8

題目說明

請撰寫一個程式來管理學生分數。 程式會輸入兩位學生的姓名、初始分數以及加分分數,並計算加分後的結果。

如果加分分數為負數,需輸出Score cannot be negative並且不進行加分。

最後請輸出兩位學生的姓名與最終分數。

輸入值的格式

第一位學生姓名 初始分數、加分分數

第二位學生姓名 初始分數、加分分數

輸出值的格式

依序輸出兩位學生的資訊,若加分為負數,需先輸出:Score cannot be negative

sample input1

Tom
80 5
Mary
90 10

sample output1

Tom 85
Mary 100

sample input2

Tom
80 -5
Mary
90 -10

sample output2

Score cannot be negative
Score cannot be negative
Tom 80
Mary 90

Comments

There are no comments at the moment.