您好我还是Netbeans的新手,并且完全是StackoverFlow和编码的新手,我需要完成SpaceInvaders游戏的制作并且我已经达到了惊人的地步。对于我的Arg-Constructor,我已经按照我前几周使用的方法,但无济于事。我理解大多数人认为这可能会让人感觉很轻松,但无论如何,我都会给任何帮助。
package model;
import dao.GameDetailsDAO;
import java.io.Serializable;
import java.sql.SQLException;
/**
* <p>
* The details for one game, including the user playing, the game settings the scoring (shots fired, ships destroyed,
* score and previous high score)
* </p>
* <p>
* Company: TAFE SA</p>
*
* @version 1.0
*/
public class GameDetails implements Serializable {
//constants
public static final int POINTS_GAINED_FOR_SHIP_DESTROYED = 100;
public static final int POINTS_LOST_FOR_WASTED_SHOT = 50;
//instance variables set at object creation time
private UserDetails userDetails;
private GameSettings gameSettings;
//instance variables NOT set at object creation time but updated through setters as game is played.
private int highScore;
private int score;
private int shipsDestroyed;
private int shotsFired;
private boolean newHighScore; //Indicates wether the highScore is a new one
//only 2 constructors required
/**
* UserDetails
*
*
*
*/
//no args constructor
public GameDetails(){
this(POINTS_GAINED_FOR_SHIP_DESTROYED , POINTS_LOST_FOR_WASTED_SHOT, new UserDetails(), new GameSettings());
}
//all args constructor
public GameDetails(UserDetails userDetails, GameSettings gameSettings, int highScore, int score, int shipsDestroyed, int shotsFired, boolean newHighScore) throws Exception {
this.userDetails = userDetails;
this.gameSettings = gameSettings;
this.highScore = highScore;
this.score = score;
this.shipsDestroyed = shipsDestroyed;
this.shotsFired = shotsFired;
this.newHighScore = newHighScore;
resetTheScoringDetails();
}
答案 0 :(得分:1)
没有为GameDetails(int,int)构造函数找到合适的构造函数GameDetails.GameDetails()不适用
您没有links = []
for div in page_soup.find_all('div', attrs={'class': 'gameLinks'}:
if 'some_date' in div.text:
for a in div.find_all('a'):
if 'ufc' in a['href']:
links.append(a['href'])
print(a['href'])
的构造函数,它只需要2 GameDetails
个参数。
你拥有的是:
int
您需要编写新的构造函数 - public GameDetails()
public GameDetails(UserDetails, GameSettings, int, int, int, int, boolean)
- 或添加/删除参数以匹配您现有的构造函数签名。