快乐逍遥人 快乐逍遥人
关注数: 0 粉丝数: 70 发帖数: 125 关注贴吧数: 0
新手问个有关return的问题 这是我做练习题时碰到的问题,请各位前辈指点下题目要求是:提示用户输入他参加了几项考试,并再次提示用户输入每项考试所得的分数,然后再将这些分数转入一个叫getGrade的method中, 并依照 分数:0-49 等级:Fail 分数:50-59 等级:Pass 分数60-69 等级:Credit 分数 70-79 等级:Distinction 分数80-100 等级: High Distinction 来判别用户该项考试所得分数因给予的等级我现在已将前面的问题做好了 可是在用return返回分数对应的等级时遇到了问题, 我用的是BlueJ, 做完后 compile,BlueJ提示我缺少return statment,但我明明有return啊,以下是我的CODE,请前辈指点 谢谢!import javax.swing.*;public class displayGrade{ public static void main(String[] args) { String promptUnits; int unit = 0; boolean invalidNumber = true; while (invalidNumber) { promptUnits = JOptionPane.showInputDialog("Enter the number of units taken"); try { unit = Integer.parseInt(promptUnits); invalidNumber = false; } catch (NumberFormatException e) { JOptionPane.showMessageDialog(null,"Invalid number"); } } for (int x=1;x<=unit;x++) { String promptMark=JOptionPane.showInputDialog("Enter a mark(integer) for unit" + x); int mark = Integer.parseInt(promptMark); while(mark < 0 || mark >100) { promptMark=JOptionPane.showInputDialog("Enter a mark(integer) for unit" + x); mark = Integer.parseInt(promptMark); } String grade = getGrade(mark); System.out.println("The grade is " + grade); }} public static String getGrade(int a) { String fail = "Fail"; String pass = "Pass"; String credit = "Credit"; String distinction = "Distinction"; String highdistinction = "High Distinction"; if (a>=0 || a<=49) return fail; else if (a<=59) return pass; else if (a<=69) return credit; else if (a<=79) return distinction; else if (a<=100) return highdistinction; } }
我帮菲戈吧的一位吧友翻译的一封信,大家评价下谢谢 原文: 当你读到这封信时,我也许正在无边的黑暗中沉沉睡去. 我一定不能理解你此刻的心情. 并不想质问你,也没有理由和权利质问你.我只是,还想再看看你的蓝黑战袍,我只是,还想看看你的身影.不是今天,不是明天,让时间再长点,好么,菲戈. 我曾经的,现在的,未来的,所有愿望,都在这里了.一切的一切,都不要了好么.用他们和我的眼泪,换我眼里的蓝黑色彩.菲戈别走,菲戈别让我为你哭泣,菲戈菲戈,心中刻的,嘴上念的,怎么都是你呢.今夜我不愿哭泣.只请你坚强的留下,好么. 年华顺水匆匆流走.记忆中斑驳着的,是那怎么也挥不去7号背影.天天年年,年年天天,怎么也无法接受的事实,他怎么就是真的呢.如果是梦,窗外的叶子怎么都零落了呢.泪水怎么,又爬上了脸庞呢. 早已说好,毕业一定飞去米兰城,寻找那个传奇的7号.可是那天,离现在还有700多天.梦想与现实的距离,总是远得无法想像.当我得知你要远走高飞,正在上课的我手里忽然失去了力量,笔尖轻轻滑过纸面,"啪"掉在了地上.弯腰下去,泪水不小心滴在了手背. 滚烫,绝望,无力. 菲戈我无法描述我的悲伤.我只知道记忆里的一些东西,永远是记忆,仅此而已.坚强的你一定不会哭吧,可是,又有多少人在为你哭泣呢,菲戈. 也许是我太天真,总幻想有一天能身着蓝黑剑条衫,站在梅阿查球场几万名球迷中间,在你走出更衣室的时候,紧紧抓住胸前的国米标志,轻轻地说一句,菲戈加油.眼里或许含着泪水,但心里,终究是温暖的. 现在这也永远只能是个梦了.等放了假,已是盛夏.在那开满细密小白花的时节,再去重温梦中情景,恐怕早已物是人非. 米兰一行,终究要去.米兰德比,依然会看.只是不知道,眼睛是否会习惯没有7号的蓝黑军团,心里,是否会惦记那个有着坚韧眼神的男人. 尽管心里早做了最坏的打算,可还是不愿意放弃心中的小小希望,期盼奇迹的出现.我只是一个普普通通的中国女孩,我不能望着你的眼睛说出这番话,所以,我写下这封信,用我的心,恳请你. 留下好么,菲戈.
baby生日快乐,我为你翻译的写给菲戈的信。 When you read this letter, it's perhaps that I'm sleeping deeply in the rimless darkness. I should never catch on the frame of your mind currently. I'm not meant to query you, reasonably or rightlessly. But please, please do not take off your blue-black jersey, I just wanna, wanna see your silhouette on the court again, neither today nor tomorrow, please prolong your career time in Inter Milan, won't you? My wishes from the past to the future are all here. Nothing is important now, I just wanna use my tears to retain the black-blue color. Do not leave us, Figo. Do not make me cry, Figo. Because you are always on my mind. I do not wanna weep any more tonight, but please, please remain here valorously, won't you? No matter how the time lapses, your #7 jersey is permanently keeped in my memory. As the time goes on , there's one thing I will never be able to accept, that's your retireness from the court, the green court. If it's not true,why my tears are sheding on my face now? I always had a dream, a dream to Milan to see the legend #7 in my heart after my graduation. Grieffully, I still get 700 days to go before I catch my dream. There is always an unfathomable distance between the dream and the real life, when the rumor came to me that you will leave for Saudi Arabia, I distinctly felt that the doom day was coming over me, and the tears shed on my face again.(这句就这样翻吧,呵呵) Scaldingly, despairingly, feebly. Figo, if I face you, I can not find a proper way to express my soreness, I know the memory is merely memory. You'll never cry as a brave warrior you are, but can you realise that how many red eyes are here for you now? Maybe I am just a naive tot who is always fantasizing to wear the blue-black jersey and stand whin the crowd at Meazza and tightly grap your jersey and bid a "forca"(用葡萄牙语的加油吧 呵呵) to you, with tears in my eyes and warmth in my heart.I will go to Milan by all means, to watch the derby match, but I just wonder whether I can see that familiar #7 again and whether I can still remember the stanch eye expression of yours.I am no more than a common Chinese girl who will never forsake her dream and always thirst for theadvent of the miracle her heart. It's a pity that I can not face you to speak out what I wanna say to you, therefore, I write this letter as a solicitation. Please do not leave us, won't you? My figo.
把微笑留给伤你最深的人 “把微笑留给伤你最深的人”无意中看见了这句话,情感的经历让自己突然有了一种文字的冲动,虽然知道文字的苍白,让情感披露的体无完肤,现实的心志,让我们无法从容的面对和坦然。我们对伤害自己的人大概永远做不到完全的“微笑”。小的时候喜欢看神话故事,记得希腊神话里面有关于阿波罗和仙女达芙涅的故事。一次,阿波罗碰到了小爱神丘比特,他嘲笑丘比特的箭象玩具一样,不可能建立不朽的功勋。丘比特听完从箭袋里取出两只不同颜色的箭,一只是金子的,一只是铅的。金子的箭是爱情之箭,而铅的箭是抗拒爱情的。丘比特把金箭射向阿波罗,把铅箭射向仙女达芙涅,一场爱情悲剧开始了。阿波罗爱上了达芙涅,而达芙涅看到阿波罗就向见到魔鬼一样。最后,为了避开阿波罗,达芙涅变成了一棵月桂树。而阿波罗为了纪念达芙涅,就用月桂枝来装饰自己的弓。丘比特因为私心伤害了一对恋人,阿波罗因为嘲笑浪费了去爱的权利,他们虽然是可悲的,但最终因为他们的事迹而流传和被人敬仰。而它们之间也并没有因为这些而成为敌人,而是互相体谅着自己的过失,微笑着。。。。这是多么坚强而又洒脱的人生,这其中要经历多少爱与恨的情感交织。男女之间从见面到心跳到两情相悦,再到彼 此间出神入化的心灵呼唤,也许要走很长一段路程;而从一切不设防到万般柔情都化作一声千肠 百结的叹息,也许只需短短的一瞬。当昔日的真爱已不存在,当情感的繁花已被冬雨打得残红飘零时,人们总是习惯于停栖在爱情的树枝上低吟浅唱,不是心里仍眷恋那份柔情,等待伤害自己的人回心转意,就是也决心以同样的方式实行报复,但这都是不明智、不潇洒、不可爱的,最恰当的方法就是微笑地向他道声珍重。把微笑给有负于我们的人,把泪水留给自己,把祝福给有负于我们的人,把痛苦留给自己,没有较高的文化素养,没有对情感细微的洞察,没有对所爱之人发自内心的挚爱,谁能做到微笑告别?把微笑留给一般的朋友不易,给有负于我们的人更是难上加难,因为最伤害我们的人可能曾经是我们最深爱的人,付出的越多,被伤害时,心里越疼,然而我们不得不微笑,感情是件很复杂的事,我们不能勉强他人,相爱时理由有千条,不爱时,这千条理由一条也站不住脚,这其中的奥秘,有谁能说得清?谁能说得清,爱情无解、爱情无常,只能微笑以对,何苦扰了别人,又伤了自己?如果玫瑰凋谢了,请把刺留给我。如果结束了,会把微笑留给你。
1 下一页