如何写一段java代码让你一个程序能自己动判断从错误的任务开始重新运行!有必要弄得这么麻烦吗拼写检查代码实现java?最直接拼写检查代码实现java的就是用oracle拼写检查代码实现java的job,全部都在数据库内部执行,不用担心链接会断掉 。
在外部实现的话也用高级点的存储过程,速度快,稳定性好 。有些业务不要完全去依赖外部程序 。想拼写检查代码实现java你这样的情况完全可以用job实现
这两道题代码怎么写java?创建一个名字为“ReportCard”的类,然后用下边的内容全部替换掉,你会成为全班最亮的仔 。
import java.util.HashMap;
/**
* 学生成绩单
*/
public class ReportCard {
public static void main(String[] args) {
ReportCard reportCard = new ReportCard("张三", "070602213");
reportCard.set("语文", 80.0);
reportCard.set("数学", 59.5);
reportCard.set("英语", 66.0);
reportCard.set("java", 80, 99.0);
reportCard.set("数据库", 80, 66.0);
reportCard.set("毛概", null);
System.out.println(reportCard.getStudentName() + "语文分数:" + reportCard.get("语文"));
System.out.println(reportCard.getStudentName() + "数学考核结果:" + (reportCard.isPassed("数学") ? "合格" : "不合格"));
System.out.println(reportCard.getStudentName() + "期末是否挂科:" + (reportCard.isAllPassed() ? "否" : "是"));
}
// 学生姓名
private String studentName;
// 学生学号
private String studentNumber;
// 成绩单
private HashMapString, CourseResult cards = new HashMap();
public ReportCard() {
}
public ReportCard(String studentName, String studentNumber) {
this.studentName = studentName;
this.studentNumber = studentNumber;
}
public Double get(String courseName){
CourseResult courseResult = cards.get(courseName);
return courseResult == null ? Double.NaN : courseResult.getStudentScore();
}
public void set(String courseName, Double studentScore){
CourseResult courseResult = new CourseResult(courseName, studentScore);
cards.put(courseName, courseResult);
}
public void set(String courseName, double passMark, Double studentScore){
CourseResult courseResult = new CourseResult(courseName, passMark, studentScore);
cards.put(courseName, courseResult);
}
public boolean isPassed(String courseName){
return cards.get(courseName).isPassed();
}
public boolean isAllPassed(){
for(CourseResult cr : cards.values()){
if ( ! cr.isPassed()) {
return false;
}
}
return true;
}
public String getStudentName() {
return studentName;
}
public String getStudentNumber() {
return studentNumber;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
}
public void setStudentNumber(String studentNumber) {
this.studentNumber = studentNumber;
}
/**
* 课程
*/
class Course{
// 课程名称
protected String courseName;
// 及格分
protected double passMark = 60;
public Course(String courseName, Double passMark) {
this.courseName = courseName;
if ( passMark != null) {
this.passMark = passMark;
}
}
}
/**
* 课程成绩
*/
class CourseResult extends Course{
// 学生成绩
private Double studentScore;
public CourseResult(String courseName, Double studentScore) {
this(courseName, null, studentScore);
}
public CourseResult(String courseName, Double passMark, Double studentScore) {
super(courseName, passMark);
this.studentScore = studentScore == null ? Double.NaN : studentScore;
}
public boolean isPassed(){
return studentScore = passMark;
推荐阅读
- 三亚保税跨境电商如何选择,三亚 保税
- tablecssw3school的简单介绍
- 一至二年级的体育游戏视频,小学一二年级体育游戏课教案
- 挖土机直播带货文案,挖土机直播带货文案范文
- 构建区块链go语言 go语言写区块链
- JS和Flutter渲染区别,flutter渲染原理
- 奶茶店早餐如何经营营销,早餐店奶茶怎么做
- 线下服装店如何推广产品,服装品牌线下推广方案
- c语言写入二进制文件函数 c语言二进制文件读写的函数