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
Nataly_w [17]
3 years ago
6

Using Java..

Engineering
1 answer:
uysha [10]3 years ago
7 0

Answer:

The source code files for this question have been attached to this response.

Please download it and go through each of the class files.

The codes contain explanatory comments explaining important segments of the codes, kindly go through these comments.

Download java
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
You might be interested in
Your program should read from an input file, which will contain one or more test cases. Each test case consists of one line cont
Aliun [14]

Answer:

#include <bits/stdc++.h>

using namespace std;

struct cell

{

int x, y;

int dis;

cell() {}

cell(int x, int y, int dis) : x(x), y(y), dis(dis) {}

};

bool isInside(int x, int y, int N)

{

if (x >= 1 && x <= N && y >= 1 && y <= N)

return true;

return false;

}

int minStepToReachTarget(int knightPos[], int targetPos[],

int N)

{

int dx[] = {-2, -1, 1, 2, -2, -1, 1, 2};

int dy[] = {-1, -2, -2, -1, 1, 2, 2, 1};

queue<cell> q;

q.push(cell(knightPos[0], knightPos[1], 0));

cell t;

int x, y;

bool visit[N + 1][N + 1];

for (int i = 1; i <= N; i++)

for (int j = 1; j <= N; j++)

visit[i][j] = false;

visit[knightPos[0]][knightPos[1]] = true;

while (!q.empty())

{

t = q.front();

q.pop();

visit[t.x][t.y] = true;

if (t.x == targetPos[0] && t.y == targetPos[1])

return t.dis;

for (int i = 0; i < 8; i++)

{

x = t.x + dx[i];

y = t.y + dy[i];

if (isInside(x, y, N) && !visit[x][y])

q.push(cell(x, y, t.dis + 1));

}

}

}

int main(){

ifstream obj("input.txt");

string line;

int x1,y1,x2,y2;

while(getline(obj,line)){

//cout<<line<<endl;

x1=line[0]-'a'+1;

y1=line[1]-'0';

x2=line[3]-'a'+1;

y2=line[4]-'0';

int N = 8;

int knightPos[] = {x1,y1};

int targetPos[] = {x2,y2};

cout <<"To get from "<<line[0]<<line[1]<<" to "<<line[3]<<line[4]<<" takes "<< minStepToReachTarget(knightPos, targetPos, N)<<" Knight Moves."<<endl;

}

return 0;

}

3 0
3 years ago
Which of the following is NOT a true statement about construction drawings?
Tems11 [23]

The answer is #4, "They are always drawn in pen. That is false, because what if they have to erase a part of their desing, then what?

3 0
2 years ago
You may wonder who the rest goes
Deffense [45]

Answer:

no not really

Explanation:

From your friendly neighborhood cereal killer,

Sir. BLOODPR1NCE

6 0
2 years ago
Explain why veracity, value, and visualization can also be said to apply to relational databases as well as Big Data.
Hatshy [7]

Answer:

Veracity, Value and Visualization are not only the characteristics of Big Data but are also the characteristics of relational databases. Veracity of data is issue with smallest data stores this is the reason that it is important in relation...

5 0
2 years ago
Suppose the working pressure for a boiler is 10 psig, then what is the corresponding absolute pressure?
yanalaym [24]

Answer:

The corresponding absolute pressure of the boiler is 24.696 pounds per square inch.

Explanation:

From Fluid Mechanics, we remember that absolute pressure (p_{abs}), measured in pounds per square inch, is the sum of the atmospheric pressure and the working pressure (gauge pressure). That is:

p_{abs} = p_{atm}+p_{g} (1)

Where:

p_{atm} - Atmospheric pressure, measured in pounds per square inch.

p_{g} - Working pressured of the boiler (gauge pressure), measured in pounds per square inch.

If we suppose that p_{atm} = 14.696\,psi and p_{g} = 10\,psi, then the absolute pressure is:

p_{abs} = 14.696\,psi+10\,psi

p_{abs} = 24.696\,psi

The corresponding absolute pressure of the boiler is 24.696 pounds per square inch.

8 0
2 years ago
Other questions:
  • Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less
    12·1 answer
  • What is the horizontal distance from Point A to toe of slope?
    12·1 answer
  • Is a street the same as a avenue
    10·2 answers
  • Pleaseeee help me with this!!
    10·1 answer
  • The production of carbon dioxide makes it unwise and unsafe to operate a tractor or any motor vehicle inside enclosed spaces suc
    13·1 answer
  • I need help asapppp!!!!!
    7·1 answer
  • Contrast the electron and hole drift velocities through a 10 um (micro meter) layer of intrinsic silicon across which a voltage
    11·1 answer
  • When economist determine that a nations GDP has declined, they can point to this as a sign of what?
    8·1 answer
  • PDC Bank is working on creating an AI application that enables customers to send SMS to the AI application to allow banking acti
    9·1 answer
  • What computer program can you use to publish and share a research project with others?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!