Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
349 views
in Technique[技术] by (71.8m points)

modulo - BlueJ为什么说模不是语句?(Why does BlueJ say that modulo isn't a statement?)

For school I have to make a little program that makes Ticket Id's.

(对于学校,我必须编写一个可以制作票证编号的小程序。)

One task says: "The ticket ID is the age modulo the length of the first name + the length of the last name. I've tried this:

(一个任务说:“票证ID是姓氏的长短+姓氏的长短的模数。我已经尝试过:)

TicketID = firstname + lastname;

(TicketID =名字+姓氏;)

TicketID.length() % age;

(TicketID.length()%年龄;)

I get the error that the % is not a statement.

(我收到%不是语句的错误。)

If you could help me that would be amazing.

(如果您能帮助我,那将是惊人的。)

Greets, Alex

(问候,亚历克斯)

  ask by Alexander Thomas translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to assign the result of % to some other variable

(您需要将%的结果分配给其他变量)

TicketID = firstname + lastname;

(here) = TicketID.length() % age;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...