Alo pessoa, nao estou a conseguir resolver esse exercicio e para 4 metodos e 1 main method:
Tenho o meu main method
package arcade;
import java.util.Scanner;
public class Arcade {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner sc = new Scanner(System.in);
System.out.println("Please enter how much credit you want to load for card1 ");
int cards1 = sc.nextInt();
System.out.println("How many games you are playing? ");
int noOFGames = sc.nextInt();
System.out.println("Please enter how much credit you want to load for card2 ");
int cards2 = sc.nextInt();
System.out.println("How many games you are playing? ");
int noOFGames2 = sc.nextInt();
Cards card1 = new Cards();
Cards card2 = new Cards();
Terminals term = new Terminals();
term.convertMoney(card1, cards2);
System.out.println(" ");
term.convertMoney(card2, cards2);
System.out.println(" ");
for (int i = 0; i < noOFGames; i++) {
}
}
}
este e meu Cards Methods
public class Cards {
private int currentBalance;
private int ticketBalance;
private int cardNumber;
private int checkBalance;
public void Cards( int currentBalance,int ticketBalance,int checkBalance ){
this.currentBalance = currentBalance;
this.ticketBalance = ticketBalance;
this.checkBalance = checkBalance;
}
public int getCurrentBalance() {
return currentBalance;
}
public void setCurrentBalance(int currentBalance) {
this.currentBalance = currentBalance;
}
public double getTicketBalance() {
return ticketBalance;
}
public void setTicketBalance(int ticketBalance) {
this.ticketBalance = ticketBalance;
}
public double getCardNumber() {
return cardNumber;
}
public void setCardNumber(int cardNumber) {
this.cardNumber = cardNumber;
}
public double getCheckBalance() {
return checkBalance;
}
public void setCheckBalance(int checkBalance) {
this.checkBalance = checkBalance;
}
}
Meu Game Method
import java.util.Random;
public class Games {
private int nrOfCredits;
private int creditBalance;
private int nrOfTickets;
private int newTotal;
private int ticketWon;
public double getCreditBalance( int CreditBalance ) {
if( CreditBalance >0){
CreditBalance = (CreditBalance -2);
}else{
System.out.println("YOu have an insufficient credits");
}
return creditBalance;
}
public int getNrOfTickets() {
Random rd = new Random();
ticketWon = rd.nextInt(100)+1;
nrOfTickets = nrOfTickets + ticketWon;
return nrOfTickets;
}
}
Prizecategory metod
public class PrizeCategory {
private String name;
private int nrOfTickets;
private int cntItems;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getCntItems() {
return cntItems;
}
public int getNrOfTickets() {
return nrOfTickets;
}
public void setCntItems(int cntItems) {
this.cntItems = cntItems;
}
}
Terminal methods
public class Terminals {
private int amountCredits;
private int cardBalance;
public int getAmountCredits() {
return amountCredits;
}
public void setAmountCredits(int amountCredits) {
this.amountCredits = amountCredits;
}
public int getCardBalance() {
return cardBalance;
}
public void setCardBalance(int cardBalance) {
this.cardBalance = cardBalance;
}
public void convertMoney(Cards card1, int amt) {
if (amt < 0) {
System.out.println("Enter the correct amount");
}else{
card1.setCurrentBalance(card1.getCurrentBalance() + (amt*2));
}
}
}
o meu exercicio pede para:
Instanciar 2 cartas e quaisquer outros objetos pode ser necessário testar o programa.
• créditos carga para cada cartão.
• Jogar um monte de jogo usando as duas cartas.
• Transferir o saldo de créditos e os bilhetes a partir do Cartão 1 a Cartão 2.
• Solicitar prêmios usando o cartão 2.
• Tente jogar um jogo e solicitar um prêmio usando cartão 1.
• Realizar o que quer que outras ações podem ser necessárias para testar seu programa.