SlideShare uma empresa Scribd logo
1 de 8
Baixar para ler offline
Do not use system.out.print comments and no scanner operations. Do not use any java library
classes or methods EXCEPT for java.util.Arrays class, class Character or Class String. here is the
task description:
Here is the starter code:
package lab5;
/**
*
* <p>Computational thinking for a software developer/computer programmer
* is a critical skill that is consistently applied. This lab requires you
* to develop a solution using Java object-oriented programming
* that simulates a basketball shootout game. </p>
* <p>Two players agree to limit the number of ball throw attempts to 3 throws each.
* The first player will make all three throw attempts
* (keep track of the successful baskets made where the ball goes into the basket). </p>
* <p> After the first player completes all three shots,
* the second player will make all three throw attempts.
* The player who makes the most baskets (gets the ball in the hoop) will be declared the winner.
* In the case of a tie, the tie counter is incremented by one.
* Then, the game is repeated until a winner can be determined.
* Note that the game can be repeated many times.</p>
* <p> The losing player of the shootout game will have to give the winning player a move ticket(s).
* The number of movie tickets is determined by the total number of baskets made by the winner,
* less the total number of baskets made by the losing player. </p>
* <p> The losing player gives half of a movie ticket for every tied game (if there were any tied
games). </p>
* <p> If the final calculated number of movie tickets has a decimal value, it should be rounded to
* the nearest whole number since you can't purchase half a ticket!</p>
* <p> Example: If the player1 made a total of 3 baskets, and player2 made a total of 2,
* and they had three tied games, the number of movie tickets would initially be {@code 3-2=1},
* but increased by {@code 3 x 0.5=1.5}, making the owed number of tickets {@code 2.5} which
must be
* rounded up to 3 movie tickets.</p>
*
* <p> Requirements: - Any use of Java library classes or methods (e.g., ArrayList,
* System.arraycopy) is forbidden. (That is, there must not be an import
* statement in the beginning of this class.) Violation of this requirement will
* result in a 50% penalty of your marks.</p>
* <p>
* - Use only if-statements and/or loops to manipulate primitive arrays (e.g.,
* int[], String[]).
* </p>
*/
public class Game {
// ALREADY IMPLEMENTED; DO NOT MODIFY
/**
* Two players agree to limit the number of ball throw attempts to 3 throws
* each. Constant value
*/
// ALREADY IMPLEMENTED; DO NOT MODIFY
private final static int NUMOFATTEMPT = 3;
/**
* The player1name is used to store the player name. The default value will be
* used if the name is not given to the player
* <p>
* The default value is <strong> <code>Unknown</code></strong>
* </p>
*/
// ALREADY IMPLEMENTED; DO NOT MODIFY
private String player1Name;
/**
* The player2name is used to store the player name. The default value will be
* used if the name is not given to the player
* <p>
* The default value is <strong> <code>Unknown</code></strong>
* </p>
*/
// ALREADY IMPLEMENTED; DO NOT MODIFY
private String player2Name;
/**
* The player1Attempt array is dynamically allocated at run time to store the
* result from player1 attempts
* <p>
* The default value is <strong> <code>false</code></strong> for each attempt
* </p>
*/
// ALREADY IMPLEMENTED; DO NOT MODIFY
private boolean[] player1Attempt;
/**
* The player2Attempt array is dynamically allocated at run time to store the
* result from player2 attempts
* <p>
* The default value is <strong> <code>false</code></strong> for each attempt
* </p>
*/
// ALREADY IMPLEMENTED; DO NOT MODIFY
private boolean[] player2Attempt;
/**
* The numberofTie is a counter to keep track of the number of tie games.
* <p>
* The default value is <strong> <code>zero</code></strong> before starting the
* game
*/
// ALREADY IMPLEMENTED; DO NOT MODIFY
private int numberofTie;
/**
* String Status keeps track of the current situation or status of the game.
* <p>
* This string changes during the game to reflect the game status.
* </p>
*/
// ALREADY IMPLEMENTED; DO NOT MODIFY
private String status;
// TODO: Your implementation starts here
// TODO: Your implementation starts here
/* Your implementation starts here
*/
/**
* Default constructor set the attributes to default values
* <p>
* <strong>Note: The constructor updated the game status after successfully
* constructing a new object from the game class </strong>
*/
public Game() {
// TODO: Your implementation starts here
}
/**
*
* <p>
* The constructor creates a new game by assigning player1name and player2 name
* attributes.
* </p>
* <p>
* If the player name is invalid, then the default value will be used.
* </p>
* <p>
* Also, the constructor makes sure other attributes are initialized to default
* values.
* </p>
* <p>
* <strong>Note: The constructor updated the game status after successfully
* constructing a new object from the game class </strong>
* </p>
*
* <p>
* Note: It is essential to read the API and check the JUnit test cases to know
* more about the default values for this game. Make sure you check
* </p>
*
* @param player1Name input string for player 1 name
* @param player2Name input string for player 2 name
*/
public Game(String player1Name, String player2Name) {
// TODO: Your implementation starts here
this.status = String.format("The game was initialized with player1(%s) and player2(%s)",
this.player1Name,
this.player2Name);
}
/**
* The getter method allows us to get a player1 name for any game object.
* @return player 1 name for this game
*/
public String getPlayer1Name() {
// TODO: Your implementation starts here
}
/**
* The getter method allows us to get a player2 name for any game object.
* @return player 2 name for this game
*/
public String getPlayer2Name() {
// TODO: Your implementation starts here
}
/**
* The getter method allows us to get a player 1 attempts status.
* @return player 1 attempt status as an array of boolean
*/
public boolean[] getPlayer1Attempt() {
// TODO: Your implementation starts here
}
/**
* The getter method allows us to get a player 2 attempts status.
* @return player 2 attempt status as an array of boolean
*/
public boolean[] getPlayer2Attempt() {
// TODO: Your implementation starts here
}
/**
* The getter method allows us to get this game status
* @return this game status
*/
public String getGameStatus() {
// TODO: Your implementation starts here
}
/**
* <p>The setter method allows us to set player1 name for this game.</p>
* <p> After the game is created, this method will enable us to change the name of player1.</p>
* <p>
* <strong>Note: The method updated the game status after successfully
* updating player name </strong>
* </p>
* <p>
* Also, the method makes sure other attributes are initialized to default
* values if the player name is invalid
* </p>
* <p>
* Note: It is essential to read the API and check the JUnit test cases to know
* more about the default values for this game. Make sure you check
* </p>
*
*
* @param player1Name input string for player1 name
*/
public void setPlayer1Name(String player1Name) {
// TODO: Your implementation starts here
}
/**
* <p>The setter method allows us to set player2 name for this game.</p>
* <p> After the game is created, this method will enable us to change the name of player2.</p>
* <p>
* <strong>Note: The method updated the game status after successfully
* updating player name </strong>
* </p>
* <p>
* Also, the method makes sure other attributes are initialized to default
* values if the player name is invalid
* </p>
*
* <p>
* Note: It is essential to read the API and check the JUnit test cases to know
* more about the default values for this game. Make sure you check
* </p>
* @param player2Name input string for player2 name
*/
public void setPlayer2Name(String player2Name) {
// TODO: Your implementation starts here
}
/**
* The setter method allows us to set player1 attempt to success.
* <p>If the input value is outside the allowed range this method does nothing.</p>
* <p>
* <strong>Note: The method updated the game status after successfully
* updating player attempt </strong>
* </p>
* <p>
* Note: It is essential to read the API and check the JUnit test cases to know
* more about the default values for this game. Make sure you check
* </p>
* @param attemptNo integer input between 0 and 2
*/
public void setPlayer1AttempttoSucess(int attemptNo) {
// TODO: Your implementation starts here
}
/**
* The setter method allows us to set player1 attempt to fail.
* <p>If the input value is outside the allowed range this method does nothing.</p>
* <p>
* <strong>Note: The method updated the game status after successfully
* updating player attempt </strong>
* </p>
* <p>
* Note: It is essential to read the API and check the JUnit test cases to know
* more about the default values for this game. Make sure you check
* </p>
* @param attemptNo integer input between 0 and 2
*/
public void setPlayer1AttempttoFail(int attemptNo) {
// TODO: Your implementation starts here
}
/**
* The setter method allows us to set player2 attempt to fail.
* <p>If the input value is outside the allowed range this method does nothing.</p>
* <p>
* <strong>Note: The method updated the game status after successfully
* updating player attempt </strong>
* </p>
* <p>
* Note: It is essential to read the API and check the JUnit test cases to know
* more about the default values for this game. Make sure you check
* </p>
* @param attemptNo integer input between 0 and 2
*/
public void setPlayer2AttempttoSucess(int attemptNo) {
// TODO: Your implementation starts here
}
/**
* The setter method allows us to set player2 attempt to success.
* <p>If the input value is outside the allowed range this method does nothing.</p>
* <p>
* <strong>Note: The method updated the game status after successfully
* updating player attempt </strong>
* </p>
* <p>
* Note: It is essential to read the API and check the JUnit test cases to know
* more about the default values for this game. Make sure you check
* </p>
* @param attemptNo integer input between 0 and 2
*/
public void setPlayer2AttempttoFail(int attemptNo) {
// TODO: Your implementation starts here
}
/**
* <p>This method determines the number of tickets based on the player1 attempt,
* player2 attempts and the number of tied games.</p>
* <p> If the game is a tie game, this method returns zero and increments the number of ties by
1.</p>
*
* <p> Example: If the player1 made a total of 3 baskets,
* and player2 made a total of 2, and they had <strong>three tied games</strong>,
* the number of movie tickets would initially be {@code 3-2=1},
* but increased by {@code 3 x 0.5=1.5}, making the owed number of tickets {@code 2.5 }
* which must be rounded up to {@code 3 } movie tickets.
* <p>
* <strong>Note: The method updated the game status after successfully
* updating player attempt </strong>
* </p>
* <p>
* Note: It is essential to read the API and check the JUnit test cases to know
* more about the default values for this game. Make sure you check
* </p>
* @return integer number of movie tickets
*/
public int getNoofMovieTicket() {
// TODO: Your implementation starts here
}
}
Please follow test cases. Examples:
Computational thinking for a software developer/computer programmer is a critical skill that is
consistently applied. This lab requires you to develop a solution using Java object-oriented
programming that simulates a basketball shootout game. Two players agree to limit the number of
ball throw attempts to 3 throws each. The first player will make all three throw attempts (keep track
of the successful baskets made where the ball goes into the basket). After the first player
completes all three shots, the second player will make all three throw attempts. The player who
makes the most baskets (gets the ball in the hoop) will be declared the winner. In the case of a tie,
the tie counter is incremented by one. Then, the game is repeated until a winner can be
determined. Note that the game can be repeated many times. The losing player of the shootout
game will have to give the winning player a movie ticket(s). The number of movie tickets is
determined by the total number of baskets made by the winner, less the total number of baskets
made by the losing player. The losing player gives half of a movie ticket for every tied game (if
there were any tied games). If the final calculated number of movie tickets has a decimal value, it
should be rounded to the nearest whole number since you can't purchase half a ticket! Example: If
the player-1 made a total of 3 baskets, and player- 2 made a total of 2 , and they had three tied
games, the number of movie tickets would initially be 3-2=1, but increased by 30.5=1.5, making
the owed number of tickets 2.5 which must be rounded up to 3 movie tickets.

Mais conteúdo relacionado

Semelhante a Do not use systemoutprint comments and no scanner operatio.pdf

CS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docx
CS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docxCS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docx
CS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docx
annettsparrow
 
Goal- Your goal in this assignment is to write a Java program that sim.pdf
Goal- Your goal in this assignment is to write a Java program that sim.pdfGoal- Your goal in this assignment is to write a Java program that sim.pdf
Goal- Your goal in this assignment is to write a Java program that sim.pdf
aaicommunication34
 
VideoGamepublic class VideoGam.pdf
VideoGamepublic class VideoGam.pdfVideoGamepublic class VideoGam.pdf
VideoGamepublic class VideoGam.pdf
annaistrvlr
 
RussianRouletteProgram
RussianRouletteProgramRussianRouletteProgram
RussianRouletteProgram
Amy Baxter
 
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdfWorking with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
udit652068
 
package com.tictactoe; public class Main {public void play() {.pdf
package com.tictactoe; public class Main {public void play() {.pdfpackage com.tictactoe; public class Main {public void play() {.pdf
package com.tictactoe; public class Main {public void play() {.pdf
info430661
 
C++ ProgrammingYou are to develop a program to read Baseball playe.pdf
C++ ProgrammingYou are to develop a program to read Baseball playe.pdfC++ ProgrammingYou are to develop a program to read Baseball playe.pdf
C++ ProgrammingYou are to develop a program to read Baseball playe.pdf
fazanmobiles
 
public class Team {Attributes private String teamId; private.pdf
public class Team {Attributes private String teamId; private.pdfpublic class Team {Attributes private String teamId; private.pdf
public class Team {Attributes private String teamId; private.pdf
anushasarees
 
C++You will design a program to play a simplified version of war, .pdf
C++You will design a program to play a simplified version of war, .pdfC++You will design a program to play a simplified version of war, .pdf
C++You will design a program to play a simplified version of war, .pdf
ezzi97
 
DiceSimulatorProgram
DiceSimulatorProgramDiceSimulatorProgram
DiceSimulatorProgram
Amy Baxter
 
import java.util.ArrayList; import java.util.Iterator; A.pdf
import java.util.ArrayList; import java.util.Iterator;   A.pdfimport java.util.ArrayList; import java.util.Iterator;   A.pdf
import java.util.ArrayList; import java.util.Iterator; A.pdf
anushafashions
 
Here are the instructions and then the code in a sec. Please R.pdf
Here are the instructions and then the code in a sec. Please R.pdfHere are the instructions and then the code in a sec. Please R.pdf
Here are the instructions and then the code in a sec. Please R.pdf
aggarwalshoppe14
 
question.(player, entity ,field and base.java codes are given)Stop.pdf
question.(player, entity ,field and base.java codes are given)Stop.pdfquestion.(player, entity ,field and base.java codes are given)Stop.pdf
question.(player, entity ,field and base.java codes are given)Stop.pdf
shahidqamar17
 
Please help with this. program must be written in C# .. All of the g.pdf
Please help with this. program must be written in C# .. All of the g.pdfPlease help with this. program must be written in C# .. All of the g.pdf
Please help with this. program must be written in C# .. All of the g.pdf
manjan6
 
Write a class (BasketballTeam) encapsulating the concept of a tea.pdf
Write a class (BasketballTeam) encapsulating the concept of a tea.pdfWrite a class (BasketballTeam) encapsulating the concept of a tea.pdf
Write a class (BasketballTeam) encapsulating the concept of a tea.pdf
rozakashif85
 

Semelhante a Do not use systemoutprint comments and no scanner operatio.pdf (20)

CS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docx
CS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docxCS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docx
CS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docx
 
Tic tac toe c++ programing
Tic tac toe c++ programingTic tac toe c++ programing
Tic tac toe c++ programing
 
Goal- Your goal in this assignment is to write a Java program that sim.pdf
Goal- Your goal in this assignment is to write a Java program that sim.pdfGoal- Your goal in this assignment is to write a Java program that sim.pdf
Goal- Your goal in this assignment is to write a Java program that sim.pdf
 
VideoGamepublic class VideoGam.pdf
VideoGamepublic class VideoGam.pdfVideoGamepublic class VideoGam.pdf
VideoGamepublic class VideoGam.pdf
 
RussianRouletteProgram
RussianRouletteProgramRussianRouletteProgram
RussianRouletteProgram
 
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdfWorking with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
 
package com.tictactoe; public class Main {public void play() {.pdf
package com.tictactoe; public class Main {public void play() {.pdfpackage com.tictactoe; public class Main {public void play() {.pdf
package com.tictactoe; public class Main {public void play() {.pdf
 
RandomGuessingGame
RandomGuessingGameRandomGuessingGame
RandomGuessingGame
 
C++ ProgrammingYou are to develop a program to read Baseball playe.pdf
C++ ProgrammingYou are to develop a program to read Baseball playe.pdfC++ ProgrammingYou are to develop a program to read Baseball playe.pdf
C++ ProgrammingYou are to develop a program to read Baseball playe.pdf
 
public class Team {Attributes private String teamId; private.pdf
public class Team {Attributes private String teamId; private.pdfpublic class Team {Attributes private String teamId; private.pdf
public class Team {Attributes private String teamId; private.pdf
 
C++You will design a program to play a simplified version of war, .pdf
C++You will design a program to play a simplified version of war, .pdfC++You will design a program to play a simplified version of war, .pdf
C++You will design a program to play a simplified version of war, .pdf
 
DiceSimulatorProgram
DiceSimulatorProgramDiceSimulatorProgram
DiceSimulatorProgram
 
Tic tac toe on c++ project
Tic tac toe on c++ projectTic tac toe on c++ project
Tic tac toe on c++ project
 
import java.util.ArrayList; import java.util.Iterator; A.pdf
import java.util.ArrayList; import java.util.Iterator;   A.pdfimport java.util.ArrayList; import java.util.Iterator;   A.pdf
import java.util.ArrayList; import java.util.Iterator; A.pdf
 
Here are the instructions and then the code in a sec. Please R.pdf
Here are the instructions and then the code in a sec. Please R.pdfHere are the instructions and then the code in a sec. Please R.pdf
Here are the instructions and then the code in a sec. Please R.pdf
 
question.(player, entity ,field and base.java codes are given)Stop.pdf
question.(player, entity ,field and base.java codes are given)Stop.pdfquestion.(player, entity ,field and base.java codes are given)Stop.pdf
question.(player, entity ,field and base.java codes are given)Stop.pdf
 
COnnect4Game
COnnect4GameCOnnect4Game
COnnect4Game
 
Nested For Loops and Class Constants in Java
Nested For Loops and Class Constants in JavaNested For Loops and Class Constants in Java
Nested For Loops and Class Constants in Java
 
Please help with this. program must be written in C# .. All of the g.pdf
Please help with this. program must be written in C# .. All of the g.pdfPlease help with this. program must be written in C# .. All of the g.pdf
Please help with this. program must be written in C# .. All of the g.pdf
 
Write a class (BasketballTeam) encapsulating the concept of a tea.pdf
Write a class (BasketballTeam) encapsulating the concept of a tea.pdfWrite a class (BasketballTeam) encapsulating the concept of a tea.pdf
Write a class (BasketballTeam) encapsulating the concept of a tea.pdf
 

Mais de adamsapparelsformen

Domes and basins In some folds Inliers and outliersFigur.pdf
Domes and basins  In some folds Inliers and outliersFigur.pdfDomes and basins  In some folds Inliers and outliersFigur.pdf
Domes and basins In some folds Inliers and outliersFigur.pdf
adamsapparelsformen
 
Does anyone have a photo of the completed moon map I need t.pdf
Does anyone have a photo of the completed moon map I need t.pdfDoes anyone have a photo of the completed moon map I need t.pdf
Does anyone have a photo of the completed moon map I need t.pdf
adamsapparelsformen
 
Do it in Java Please ExamPrep4_Spring2023 Source Packages lo.pdf
Do it in Java Please ExamPrep4_Spring2023 Source Packages lo.pdfDo it in Java Please ExamPrep4_Spring2023 Source Packages lo.pdf
Do it in Java Please ExamPrep4_Spring2023 Source Packages lo.pdf
adamsapparelsformen
 
DNA exits mostly as a double stranded molecule Because of .pdf
DNA exits mostly as a double stranded molecule Because of .pdfDNA exits mostly as a double stranded molecule Because of .pdf
DNA exits mostly as a double stranded molecule Because of .pdf
adamsapparelsformen
 

Mais de adamsapparelsformen (20)

Doctors Diaries is a 1990s documentary following a group of.pdf
Doctors Diaries is a 1990s documentary following a group of.pdfDoctors Diaries is a 1990s documentary following a group of.pdf
Doctors Diaries is a 1990s documentary following a group of.pdf
 
Dont respond to this questionGive only the references Bib.pdf
Dont respond to this questionGive only the references Bib.pdfDont respond to this questionGive only the references Bib.pdf
Dont respond to this questionGive only the references Bib.pdf
 
dogh dogcpp maincpp For the code above How many MyCo Cop.pdf
dogh dogcpp maincpp For the code above How many MyCo Cop.pdfdogh dogcpp maincpp For the code above How many MyCo Cop.pdf
dogh dogcpp maincpp For the code above How many MyCo Cop.pdf
 
Donald Lyles 52year old male was admitted yesterday eveni.pdf
Donald Lyles 52year old male was admitted yesterday eveni.pdfDonald Lyles 52year old male was admitted yesterday eveni.pdf
Donald Lyles 52year old male was admitted yesterday eveni.pdf
 
Domes and basins In some folds Inliers and outliersFigur.pdf
Domes and basins  In some folds Inliers and outliersFigur.pdfDomes and basins  In some folds Inliers and outliersFigur.pdf
Domes and basins In some folds Inliers and outliersFigur.pdf
 
Dolce is an Italian company selling highend turnkey kitchen.pdf
Dolce is an Italian company selling highend turnkey kitchen.pdfDolce is an Italian company selling highend turnkey kitchen.pdf
Dolce is an Italian company selling highend turnkey kitchen.pdf
 
Do This Consider the partial class declarations below A co.pdf
Do This Consider the partial class declarations below A co.pdfDo This Consider the partial class declarations below A co.pdf
Do This Consider the partial class declarations below A co.pdf
 
Doede Corporation uses activitybased costing to compute pro.pdf
Doede Corporation uses activitybased costing to compute pro.pdfDoede Corporation uses activitybased costing to compute pro.pdf
Doede Corporation uses activitybased costing to compute pro.pdf
 
Does anyone have a photo of the completed moon map I need t.pdf
Does anyone have a photo of the completed moon map I need t.pdfDoes anyone have a photo of the completed moon map I need t.pdf
Does anyone have a photo of the completed moon map I need t.pdf
 
Document your result for H influenzae below 1 What is the.pdf
Document your result for H influenzae below 1 What is the.pdfDocument your result for H influenzae below 1 What is the.pdf
Document your result for H influenzae below 1 What is the.pdf
 
Doal gaz doru bir ekilde tanmlayan ifadeyi sein Fracking.pdf
Doal gaz doru bir ekilde tanmlayan ifadeyi sein  Fracking.pdfDoal gaz doru bir ekilde tanmlayan ifadeyi sein  Fracking.pdf
Doal gaz doru bir ekilde tanmlayan ifadeyi sein Fracking.pdf
 
Do it in Java Problem4 Natural Language Processing Writ.pdf
Do it in Java Problem4 Natural Language Processing Writ.pdfDo it in Java Problem4 Natural Language Processing Writ.pdf
Do it in Java Problem4 Natural Language Processing Writ.pdf
 
Diyelim ki mevcut d politikann aksine ABD ve Meksika farkl .pdf
Diyelim ki mevcut d politikann aksine ABD ve Meksika farkl .pdfDiyelim ki mevcut d politikann aksine ABD ve Meksika farkl .pdf
Diyelim ki mevcut d politikann aksine ABD ve Meksika farkl .pdf
 
Do it in Java Please ExamPrep4_Spring2023 Source Packages lo.pdf
Do it in Java Please ExamPrep4_Spring2023 Source Packages lo.pdfDo it in Java Please ExamPrep4_Spring2023 Source Packages lo.pdf
Do it in Java Please ExamPrep4_Spring2023 Source Packages lo.pdf
 
DNA replikasyonundan geen bakterileri moleklleri izlemeni.pdf
DNA replikasyonundan geen bakterileri moleklleri izlemeni.pdfDNA replikasyonundan geen bakterileri moleklleri izlemeni.pdf
DNA replikasyonundan geen bakterileri moleklleri izlemeni.pdf
 
DNA exits mostly as a double stranded molecule Because of .pdf
DNA exits mostly as a double stranded molecule Because of .pdfDNA exits mostly as a double stranded molecule Because of .pdf
DNA exits mostly as a double stranded molecule Because of .pdf
 
Dk bir gerileme R2 u anlama gelir A sol taraftaki d.pdf
Dk bir gerileme  R2  u anlama gelir   A  sol taraftaki d.pdfDk bir gerileme  R2  u anlama gelir   A  sol taraftaki d.pdf
Dk bir gerileme R2 u anlama gelir A sol taraftaki d.pdf
 
Divisional Income Statements and Retum on fnvestment Analysi.pdf
Divisional Income Statements and Retum on fnvestment Analysi.pdfDivisional Income Statements and Retum on fnvestment Analysi.pdf
Divisional Income Statements and Retum on fnvestment Analysi.pdf
 
discussing Monopolies and Externalities Positive and Negati.pdf
discussing Monopolies and Externalities Positive and Negati.pdfdiscussing Monopolies and Externalities Positive and Negati.pdf
discussing Monopolies and Externalities Positive and Negati.pdf
 
Distinguish time clauses from conditions and name the types .pdf
Distinguish time clauses from conditions and name the types .pdfDistinguish time clauses from conditions and name the types .pdf
Distinguish time clauses from conditions and name the types .pdf
 

Último

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Último (20)

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

Do not use systemoutprint comments and no scanner operatio.pdf

  • 1. Do not use system.out.print comments and no scanner operations. Do not use any java library classes or methods EXCEPT for java.util.Arrays class, class Character or Class String. here is the task description: Here is the starter code: package lab5; /** * * <p>Computational thinking for a software developer/computer programmer * is a critical skill that is consistently applied. This lab requires you * to develop a solution using Java object-oriented programming * that simulates a basketball shootout game. </p> * <p>Two players agree to limit the number of ball throw attempts to 3 throws each. * The first player will make all three throw attempts * (keep track of the successful baskets made where the ball goes into the basket). </p> * <p> After the first player completes all three shots, * the second player will make all three throw attempts. * The player who makes the most baskets (gets the ball in the hoop) will be declared the winner. * In the case of a tie, the tie counter is incremented by one. * Then, the game is repeated until a winner can be determined. * Note that the game can be repeated many times.</p> * <p> The losing player of the shootout game will have to give the winning player a move ticket(s). * The number of movie tickets is determined by the total number of baskets made by the winner, * less the total number of baskets made by the losing player. </p> * <p> The losing player gives half of a movie ticket for every tied game (if there were any tied games). </p> * <p> If the final calculated number of movie tickets has a decimal value, it should be rounded to * the nearest whole number since you can't purchase half a ticket!</p> * <p> Example: If the player1 made a total of 3 baskets, and player2 made a total of 2, * and they had three tied games, the number of movie tickets would initially be {@code 3-2=1}, * but increased by {@code 3 x 0.5=1.5}, making the owed number of tickets {@code 2.5} which must be * rounded up to 3 movie tickets.</p> * * <p> Requirements: - Any use of Java library classes or methods (e.g., ArrayList, * System.arraycopy) is forbidden. (That is, there must not be an import * statement in the beginning of this class.) Violation of this requirement will * result in a 50% penalty of your marks.</p> * <p> * - Use only if-statements and/or loops to manipulate primitive arrays (e.g., * int[], String[]). * </p> */
  • 2. public class Game { // ALREADY IMPLEMENTED; DO NOT MODIFY /** * Two players agree to limit the number of ball throw attempts to 3 throws * each. Constant value */ // ALREADY IMPLEMENTED; DO NOT MODIFY private final static int NUMOFATTEMPT = 3; /** * The player1name is used to store the player name. The default value will be * used if the name is not given to the player * <p> * The default value is <strong> <code>Unknown</code></strong> * </p> */ // ALREADY IMPLEMENTED; DO NOT MODIFY private String player1Name; /** * The player2name is used to store the player name. The default value will be * used if the name is not given to the player * <p> * The default value is <strong> <code>Unknown</code></strong> * </p> */ // ALREADY IMPLEMENTED; DO NOT MODIFY private String player2Name; /** * The player1Attempt array is dynamically allocated at run time to store the * result from player1 attempts * <p> * The default value is <strong> <code>false</code></strong> for each attempt * </p> */ // ALREADY IMPLEMENTED; DO NOT MODIFY private boolean[] player1Attempt; /** * The player2Attempt array is dynamically allocated at run time to store the * result from player2 attempts * <p> * The default value is <strong> <code>false</code></strong> for each attempt * </p> */
  • 3. // ALREADY IMPLEMENTED; DO NOT MODIFY private boolean[] player2Attempt; /** * The numberofTie is a counter to keep track of the number of tie games. * <p> * The default value is <strong> <code>zero</code></strong> before starting the * game */ // ALREADY IMPLEMENTED; DO NOT MODIFY private int numberofTie; /** * String Status keeps track of the current situation or status of the game. * <p> * This string changes during the game to reflect the game status. * </p> */ // ALREADY IMPLEMENTED; DO NOT MODIFY private String status; // TODO: Your implementation starts here // TODO: Your implementation starts here /* Your implementation starts here */ /** * Default constructor set the attributes to default values * <p> * <strong>Note: The constructor updated the game status after successfully * constructing a new object from the game class </strong> */ public Game() { // TODO: Your implementation starts here } /** * * <p> * The constructor creates a new game by assigning player1name and player2 name * attributes. * </p> * <p> * If the player name is invalid, then the default value will be used. * </p> * <p> * Also, the constructor makes sure other attributes are initialized to default
  • 4. * values. * </p> * <p> * <strong>Note: The constructor updated the game status after successfully * constructing a new object from the game class </strong> * </p> * * <p> * Note: It is essential to read the API and check the JUnit test cases to know * more about the default values for this game. Make sure you check * </p> * * @param player1Name input string for player 1 name * @param player2Name input string for player 2 name */ public Game(String player1Name, String player2Name) { // TODO: Your implementation starts here this.status = String.format("The game was initialized with player1(%s) and player2(%s)", this.player1Name, this.player2Name); } /** * The getter method allows us to get a player1 name for any game object. * @return player 1 name for this game */ public String getPlayer1Name() { // TODO: Your implementation starts here } /** * The getter method allows us to get a player2 name for any game object. * @return player 2 name for this game */ public String getPlayer2Name() { // TODO: Your implementation starts here } /** * The getter method allows us to get a player 1 attempts status. * @return player 1 attempt status as an array of boolean */ public boolean[] getPlayer1Attempt() { // TODO: Your implementation starts here }
  • 5. /** * The getter method allows us to get a player 2 attempts status. * @return player 2 attempt status as an array of boolean */ public boolean[] getPlayer2Attempt() { // TODO: Your implementation starts here } /** * The getter method allows us to get this game status * @return this game status */ public String getGameStatus() { // TODO: Your implementation starts here } /** * <p>The setter method allows us to set player1 name for this game.</p> * <p> After the game is created, this method will enable us to change the name of player1.</p> * <p> * <strong>Note: The method updated the game status after successfully * updating player name </strong> * </p> * <p> * Also, the method makes sure other attributes are initialized to default * values if the player name is invalid * </p> * <p> * Note: It is essential to read the API and check the JUnit test cases to know * more about the default values for this game. Make sure you check * </p> * * * @param player1Name input string for player1 name */ public void setPlayer1Name(String player1Name) { // TODO: Your implementation starts here } /** * <p>The setter method allows us to set player2 name for this game.</p> * <p> After the game is created, this method will enable us to change the name of player2.</p> * <p> * <strong>Note: The method updated the game status after successfully * updating player name </strong>
  • 6. * </p> * <p> * Also, the method makes sure other attributes are initialized to default * values if the player name is invalid * </p> * * <p> * Note: It is essential to read the API and check the JUnit test cases to know * more about the default values for this game. Make sure you check * </p> * @param player2Name input string for player2 name */ public void setPlayer2Name(String player2Name) { // TODO: Your implementation starts here } /** * The setter method allows us to set player1 attempt to success. * <p>If the input value is outside the allowed range this method does nothing.</p> * <p> * <strong>Note: The method updated the game status after successfully * updating player attempt </strong> * </p> * <p> * Note: It is essential to read the API and check the JUnit test cases to know * more about the default values for this game. Make sure you check * </p> * @param attemptNo integer input between 0 and 2 */ public void setPlayer1AttempttoSucess(int attemptNo) { // TODO: Your implementation starts here } /** * The setter method allows us to set player1 attempt to fail. * <p>If the input value is outside the allowed range this method does nothing.</p> * <p> * <strong>Note: The method updated the game status after successfully * updating player attempt </strong> * </p> * <p> * Note: It is essential to read the API and check the JUnit test cases to know * more about the default values for this game. Make sure you check * </p>
  • 7. * @param attemptNo integer input between 0 and 2 */ public void setPlayer1AttempttoFail(int attemptNo) { // TODO: Your implementation starts here } /** * The setter method allows us to set player2 attempt to fail. * <p>If the input value is outside the allowed range this method does nothing.</p> * <p> * <strong>Note: The method updated the game status after successfully * updating player attempt </strong> * </p> * <p> * Note: It is essential to read the API and check the JUnit test cases to know * more about the default values for this game. Make sure you check * </p> * @param attemptNo integer input between 0 and 2 */ public void setPlayer2AttempttoSucess(int attemptNo) { // TODO: Your implementation starts here } /** * The setter method allows us to set player2 attempt to success. * <p>If the input value is outside the allowed range this method does nothing.</p> * <p> * <strong>Note: The method updated the game status after successfully * updating player attempt </strong> * </p> * <p> * Note: It is essential to read the API and check the JUnit test cases to know * more about the default values for this game. Make sure you check * </p> * @param attemptNo integer input between 0 and 2 */ public void setPlayer2AttempttoFail(int attemptNo) { // TODO: Your implementation starts here } /** * <p>This method determines the number of tickets based on the player1 attempt, * player2 attempts and the number of tied games.</p> * <p> If the game is a tie game, this method returns zero and increments the number of ties by 1.</p>
  • 8. * * <p> Example: If the player1 made a total of 3 baskets, * and player2 made a total of 2, and they had <strong>three tied games</strong>, * the number of movie tickets would initially be {@code 3-2=1}, * but increased by {@code 3 x 0.5=1.5}, making the owed number of tickets {@code 2.5 } * which must be rounded up to {@code 3 } movie tickets. * <p> * <strong>Note: The method updated the game status after successfully * updating player attempt </strong> * </p> * <p> * Note: It is essential to read the API and check the JUnit test cases to know * more about the default values for this game. Make sure you check * </p> * @return integer number of movie tickets */ public int getNoofMovieTicket() { // TODO: Your implementation starts here } } Please follow test cases. Examples: Computational thinking for a software developer/computer programmer is a critical skill that is consistently applied. This lab requires you to develop a solution using Java object-oriented programming that simulates a basketball shootout game. Two players agree to limit the number of ball throw attempts to 3 throws each. The first player will make all three throw attempts (keep track of the successful baskets made where the ball goes into the basket). After the first player completes all three shots, the second player will make all three throw attempts. The player who makes the most baskets (gets the ball in the hoop) will be declared the winner. In the case of a tie, the tie counter is incremented by one. Then, the game is repeated until a winner can be determined. Note that the game can be repeated many times. The losing player of the shootout game will have to give the winning player a movie ticket(s). The number of movie tickets is determined by the total number of baskets made by the winner, less the total number of baskets made by the losing player. The losing player gives half of a movie ticket for every tied game (if there were any tied games). If the final calculated number of movie tickets has a decimal value, it should be rounded to the nearest whole number since you can't purchase half a ticket! Example: If the player-1 made a total of 3 baskets, and player- 2 made a total of 2 , and they had three tied games, the number of movie tickets would initially be 3-2=1, but increased by 30.5=1.5, making the owed number of tickets 2.5 which must be rounded up to 3 movie tickets.