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
Lisa [10]
3 years ago
7

Your project must satisfy the following requirements:

Computers and Technology
1 answer:
melomori [17]3 years ago
7 0

Answer:

Check the explanation

Explanation:

using System;

using System.Collections;

namespace HelloWorldApplication

{

class Temperature{

public double degrees;

double scale; // use of this field is not specified

public override string ToString(){

return ("degrees:"+degrees+", scale:"+scale);

}

}

class Location{

int x;

int y;

public Location(int x, int y){

this.x = x;

this.y = y;

}

public double getDistance(Location otherLoc){

return Math.Sqrt((x-otherLoc.x)*(x-otherLoc.x) +(y-otherLoc.y)*(y-otherLoc.y) );

}

public override string ToString(){

return ("("+x+", "+y+")");

}

}

class Pool{

public Pool(){

count++;

}

public static int count=0;

public Location location;

public Temperature temperature;

public override string ToString(){

return ("location:"+location+", temperature:"+temperature);

}

}

class Driver

{

static void Main(string[] args)

{

Random r = new Random();

ArrayList list = new ArrayList();

Console.WriteLine("Before adding pool count : "+Pool.count);

Pool pool = new Pool();

pool.location = new Location(4,8);

pool.temperature = new Temperature();

pool. temperature. degrees =r. Next (98,105);

list. Add(pool);

Console. WriteLine("After adding pool count : "+Pool. count);

Console.WriteLine("Before adding pool count : "+Pool.count);

pool = new Pool();

pool.location = new Location(12,9);

pool.temperature = new Temperature();

pool. temperature. degrees =r.Next (98,105);

list.Add(pool);

Console.WriteLine("After adding pool count : "+Pool.count);

Console.WriteLine("Before adding pool count : "+Pool.count);

pool = new Pool();

pool.location = new Location(6,6);

pool.temperature = new Temperature();

pool.temperature. degrees =r.Next (98,105);

list.Add(pool);

Console.WriteLine("After adding pool count : "+Pool.count);

Location location = new Location(0,0);

// You can even use Minimum Spanning Tree algorithm to reduce the time complexity

Console.WriteLine("Path is : ");

while(list.Count > 0){

Pool selectedPool = null;

double dist =double.MaxValue;

foreach (Pool i in list)

{

if(i.location.getDistance(location) < dist){

selectedPool = i;

}

}

Console.Write(selectedPool + " >> " );

location = selectedPool.location;

list.Remove(selectedPool);

}

/* my first program in C# */

Console.WriteLine(" end.");

Console.ReadKey();

}

}

}

You might be interested in
Selena needs to insert a comment in a webpage's code to ensure that other web team members who work with the page code understan
ANTONII [103]

Answer:

<!-- Modified by selena ramirez - for html compliance -->

Explanation:

In HTML, <!-- .. --> tag is used to insert comments in the webpage code.

Comments written inside the tag is visible only on the code, and is not displayed in the browsers when the page is requested by the client computer.

<em>Comment tag</em> is useful when there is a lot of code and multiple developers are dealing with the same code.

Comments help developers understand what changed is made and why.

5 0
3 years ago
"the most common way to access the internet is through ________."
liubo4ka [24]
The most common was is your phone
6 0
3 years ago
How many times should the start function be defined in a program?
tatyana61 [14]

Answer:

0 1 2 However many you like

✓ I think its 2x they will start to define the program

4 0
3 years ago
Question 1
weeeeeb [17]

Answer:

-6.4

Explanation:

just divide -32 by 5 and you will get your answer of -6.4

7 0
3 years ago
When did economies begin?
Pavlova-9 [17]
They began in ancient times the babylons started trading
6 0
3 years ago
Read 2 more answers
Other questions:
  • Array A is not a heap. Clearly explain why does above tree not a heap? b) Using build heap procedure discussed in the class, con
    15·1 answer
  • How do keystroke dynamics determine whether to authenticate an individual or not?
    14·1 answer
  • Think back over the information presented in the lesson about how you can skillfully use the Internet when doing research. Selec
    14·1 answer
  • Wireframing and storyboarding are helpful in which step of web development?
    13·2 answers
  • What are the methods of identifying publicly switched networks?
    14·1 answer
  • What in the LAN for a small office, some user devices connect to the LAN using a cable, while others connect using wireless tech
    14·1 answer
  • What is the term for a set of actions carried out on inputs?
    7·1 answer
  • ...................You like swamps
    13·2 answers
  • If a file you are opening for appending does not exist, the operating system will detect the missing file and terminate the oper
    14·1 answer
  • Why does a computer need memory​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!