编程小白的博客

编程小白的博客日记

  • 2018-11-14 星期三 下雨

为什么这几天都下雨呀,很难受。
今天下午才把eclipse给搞好,最开始eclipse一直都不能编译运行程序,把我当初用文本文件写的代码放进去完全运行不了。然后百度了一下,感觉eclipse里面的要求有点严格呀,不能像c语言那样直接只创建个文件就可以写代码了,在eclipse里必须要写创建个Java project ,然后在jre中右键创建package,第一个程序可以不用自己创建package,但是之后的都需要自己创建,应该是package不能重名吧,创建package后再创建class类,就可以开心地开始打代码了。编程入门传统操作:先学会打Hello World。然后又搞了下输入,都是最基本的东西,但感觉有些格式还不是记得很清楚呀,还要多加练习!
原本还想照着视频,把输入输出窗口化的代码打一遍呢,但是好像有点晚了,明天还有早读,所以还是明天再弄吧,看早上6点能不能起来马上把那个给弄好。

在这里插入图片描述

在这里插入图片描述

最简单的两个java程序。

期末作业要求如下: Write a program that will help elementary school pupils practice math. a) The program will first ask the user for his/her ID number (including two letters & 4 digits), e.g. Please input your four digit ID no: AB1234 The program should have input validation. Then the program prompts three choices: (1) Start a test (2) Check scores (3) Exit Test: the program will give 10 math problems, e.g.: 12 * 3 = 36 48 + 32 = 80 … 56 / 28 = 2 Note: i) Pupils will answer each problem before the next one is given. ii) The problems should include addition, subtraction, multiplication and division. They are randomly generated. iii) Randomly generates numbers for problems. However, must ensure that both the problem and the result are no larger than two digits. The problem and the result should be greater than or equal to zero. The divisor cannot be zero. iv) After ten problems are finished, record the time used by the student to do the ten problems. v) Gives a score to each student. Saves this student’s ID, his/her score and the time used into a file named ‘record.txt’. vi) Print the following information on the screen: Prob. | Correct Answ. | Ur Answ c) Check scores: Searches the file ‘record.txt’ and lists all the historical scores for this student, e.g.: Your previous records are: AB1234 80 150 seconds AB1234 50 182 seconds AB1234 90 98 seconds You will be marked based on your program’s: (1) Correctiveness (2) Readability (3) Robustness (4) Conciseness 目前本人的程序可以直接使用,并完全满足要求。还是建议学弟学妹在字里行间多多理解,争取自己写出漂亮的代码! 向本人在完成此作业过程中参考的代码表示衷心的感谢!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值