1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
skad [1K]
3 years ago
9

Create a TicTacToe class that initializes a 3x3 board of "-" values. We will use this class in future exercises to fully build o

ut a Tic Tac Toe game! The TicTacToe class should have a 2D array as an instance variable and a constructor that initializes the 2D array with the "-" value. Add a getter method that returns the private 2D instance variable.
Computers and Technology
1 answer:
kap26 [50]3 years ago
8 0

Answer:

public class TicTacToe //Defining TicTacToe class

{

char board[3][3] ; //Creating a 2D array instance variable

TicTacToe() //Constructor to initialize the array with " - "

{

for( int i = 0;i<3;i++) //Loop for the row of array

{

for(int j = 0;j<3;j++) //Loop for the column of array

{

Board[i][j] = '-'; //Assigning "-" in each cell

}

}

}

public char getter() //Defining getter() method to return the array

{

return Board; //returning the array

}

}

You might be interested in
Jim, your organizations IAM, has been contacted by the Program Manager to assist in implementing the DIACAP. Jim is not required
padilas [110]

IAM stands for<em> </em>Identity Access Management and includes processes focused on control of user access to critical information.

DIACEP on the other hand stands for DoD Information Assurance Certification and Accreditation Process and it is a process which ensures that companies  apply risk management to information systems (IS). According these explanations, the statement that Jim who is IAM in the organization is not required to assist the PM in implementing the DIACAP is false. In contrast, it is required that he works on this process.

5 0
3 years ago
Which two statements are true regarding the user exec mode? (choose two.)?
likoan [24]
<span>Global configuration mode can be accessed by entering the enable command.</span><span>
The device prompt for this mode ends with the ">" symbol.</span>
8 0
3 years ago
Which term refers to the science that specifies the design and arrangement of items you use so you interact with the items effic
sashaice [31]

Answer:

the ergonomics To prevent a laptop from being stolen, you can use a surge protector. False; To prevent laptops from being stolen, you can use a cable lock. What is a digital certificate?

6 0
2 years ago
Why is it generally a good idea to set the font size to at least 30 points in presentations?
vova2212 [387]
<span>It is generally a good idea to set the font size to at least 30 points in presentations </span><span>to ensure readability even from a distance.</span>
8 0
3 years ago
Read 2 more answers
2) [13 points] You’ve been hired by Banker Bisons to write a C++ console application that determines the number of months to rep
Paha777 [63]

Answer:

Check the explanation

Explanation:

CODE:

#include <iostream>

#include <iomanip>

using namespace std;

double getLoanAmount() { // functions as per asked in question

double loan;

while(true){ // while loop is used to re prompt

cout << "Enter the car loan amount ($2,500-7,500): ";

cin >> loan;

if (loan>=2500 && loan <= 7500){ // if the condition is fulfilled then

break; // break statement is use to come out of while loop

}

else{ // else error message is printed

cout << "Error: $"<< loan << " is an invalid loan amount." << endl;

}

}

return loan;

}

double getMonthlyPayment(){ // functions as per asked in question

double monthpay;

while(true){ // while loop is used to re prompt

cout << "Enter the monthly payment ($50-750): ";

cin >> monthpay;

if (monthpay>=50 && monthpay <= 750){ // if the condition is fulfilled then

break; // break statement is use to come out of while loop

}

else{ // else error message is printed

cout << "Error: $"<< monthpay << " is an invalid monthly payment." << endl;

}

}

return monthpay;

}

double getInterestRate(){ // functions as per asked in question

double rate;

while(true){ // while loop is used to re prompt

cout << "Enter the annual interest rate (1-6%): ";

cin >> rate;

if (rate>=1 && rate <= 6){ // if the condition is fulfilled then

break; // break statement is use to come out of while loop

}

else{ // else error message is printed

cout << "Error: "<< rate << "% is an invalid annual interest rate." << endl;

}

}

return rate;

}

int main() {

cout << setprecision(2) << fixed; // to print with 2 decimal places

int month = 0; // initializing month

// calling functions and storing the returned value

double balance= getLoanAmount();

double payment= getMonthlyPayment();

double rate= getInterestRate();

rate = rate /12 /100; // as per question

// printing as per required in question

cout << "Month Balance($) Payment($) Interest($) Principal($)"<< endl;

while(balance>0){ // while the balance is more than zero

month = month + 1; // counting Months

// calculations as per questions

double interest = balance * rate;

double principal = payment - interest;

balance = balance - principal;

// printing required info with proper spacing

cout <<" "<< month;

cout <<" "<< balance;

cout <<" "<< payment;

cout <<" "<< interest;

cout <<" "<< principal << endl;

}

cout << "Months to repay loan: " << month << endl; // displaying month

cout << "End of Banker Bisons";

Kindly check the output in the attached image below.

5 0
3 years ago
Other questions:
  • Janice has a "jammed" key on her keyboard. Every time she strikes the "S" key it sticks and doesn't pop back. What should Janice
    6·2 answers
  • X2/3-2x1/3-35=0
    14·1 answer
  • If i throw papers in the dryer to help them dry faster could that mess up the dryer?
    5·1 answer
  • P3. In Section 4.2 , we noted that the maximum queuing delay is (n–1)D if the switching fabric is n times faster than the input
    8·1 answer
  • What natural resource are available on the coast but not somewhereelse
    13·1 answer
  • A network technician is designing a network for a small company. The network technician needs to implement an email server and w
    7·1 answer
  • What is one pass of a coding sequence called?​
    13·2 answers
  • What is the plan to make optimum usage of available spaces?
    15·1 answer
  • Implement a simplified version of a crypto broker platform. Initially, there is an array of users, with each user depositing onl
    8·1 answer
  • What option in the zone aging/scavenging properties dialog box will prevent dns record time stamps from being updated too often?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!