第一次迭代作业

时间:2022-04-09 16:44:14

第一次迭代作业package com.test;

import java.util.Scanner;

import com.user.bean.GamesInfo;
import com.user.dao.GamesInfoDao;
import com.user.dao.impl.GamesInfoDaoImpl;

public class TestGetGameByID {
public static void main(String[] args) {
 /**
  * 用户查询比赛
  * */
 GamesInfoDao gamesInfoDao=new GamesInfoDaoImpl();//实例化接口实现类
 Scanner input=new Scanner(System.in);//输入实现类
 System.out.println("请输入比赛场次:");
 int RA=input.nextInt();//接收用户输入查询场次
 GamesInfo gamesInfo=gamesInfoDao.getgameByID(RA);//查询场次为RA的比赛详细信息
 
 System.out.println("比赛场次:"+gamesInfo.getgID());
 int one=gamesInfo.getgOne();
 int two=gamesInfo.getgTwo();
 int three=gamesInfo.getgThree();
 int four=gamesInfo.getgFour();
 int five=gamesInfo.getgFive();
 
 if(one+two+three+four+five>3){
  System.out.println(gamesInfo.getgTeam1()+":胜利");
  System.out.println(gamesInfo.getgTeam2()+":失败");
 }else{
  System.out.println(gamesInfo.getgTeam1()+":失败");
  System.out.println(gamesInfo.getgTeam2()+":胜利");
 }
 }
}