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
mixer [17]
4 years ago
6

Write in Java please

Computers and Technology
1 answer:
Mariulka [41]4 years ago
8 0

Answer: Provided in the section below

Explanation:

Using C# Code:

using System;

class Environment{

//temperature

private double temp;

//sets initial value of temp to 100 Fahrenheits

public Environment(){

temp=100;

}

//sets initial value to given temp

public Environment(double t) {

this.temp = t;

}

//returns temp

public double getTemp(){

return temp;

}

//calculates temp at given frequency

public void calcTemperature(double frequency){

temp=(frequency+40)/4.0;

}

}

class Cricket{

private Random r=new Random();

//frequency of birds

protected double frequency;

//sets frequency to a random value between 0-100

public Cricket(){

 

frequency=r.NextDouble()*100;

}

//sets frequency to a given frequency

public Cricket(double f) {

frequency = f;

}

//returns the frequency

public double getFrequency() {

return frequency;

}

//randomize the frequency

public virtual void randomFrequency() {

frequency = r.NextDouble()*100;

}

}

class ClemsonCricket: Cricket{

//sets the frequency to 80% of the parent's

public ClemsonCricket(): base(){

frequency=frequency*0.8;

}

//sets frequency to a given frequency

public ClemsonCricket(double f): base(f){}

//randomize frequency and sets it to 80% of the parent's

public override void randomFrequency(){

base.randomFrequency();

frequency=frequency*0.8;

}

}

public class testCrickets {

static void Main(){

Environment env=new Environment();

Console.WriteLine("Initial Temp: "+env.getTemp());

Cricket cricket=new Cricket();

env.calcTemperature(cricket.getFrequency());

Console.WriteLine(String.Format("Temp before changing Frequency: {0:0.00}",env.getTemp()));

cricket.randomFrequency();

env.calcTemperature(cricket.getFrequency());

Console.WriteLine(String.Format("\nTemp after changing Freqency: {0:0.00}",env.getTemp()));

Console.WriteLine("\nClemson Cricket: ");

ClemsonCricket clemsonCricket=new ClemsonCricket();

env.calcTemperature(clemsonCricket.getFrequency());

Console.WriteLine(String.Format("Temp before changing Frequency: {0:0.00}",env.getTemp()));

clemsonCricket.randomFrequency();

env.calcTemperature(clemsonCricket.getFrequency());

Console.WriteLine(String.Format("\nTemp after changing Freqency: {0:0.00}" ,env.getTemp()));

Console.WriteLine("\nPolymorphism Clemson Cricket: ");

Cricket Ccricket=new ClemsonCricket();

env.calcTemperature(Ccricket.getFrequency());

Console.WriteLine(String.Format("Temp before changing Frequency: {0:0.00}",env.getTemp()));

Ccricket.randomFrequency();

env.calcTemperature(Ccricket.getFrequency());

Console.WriteLine(String.Format("\nTemp after changing Freqency: {0:0.00}",env.getTemp()));

}

}

cheers i hope this helped !!

You might be interested in
You type a web address in your web browser. order the steps, which describe the internet name resolution process for the web add
padilas [110]
First of all let's make it clearer, what is meant by "domain name resolution"?
"Domain name resolution" is the process of translating your web address into its corresponding IP address. e.g. translating (www.brainly.com to 104.16.32.180)
Computers cannot understand the human language they only can understand numbers that's why we need this process.

So, the process (in a very simple way) is divided into four steps:
1) Lookup "root nameservers"
2) Lookup "Top Level Domain TDL nameservers"
3) Lookup "domain nameservers"
4) Lookup "subdomain nameservers" [if exist]

If you still confused please check out this video https://www.youtube.com/watch?v=BCjUbpIzRs8&index=10&list=PL4bq-KmCeyBmMvBB3-RT6ikdp8ljV9GeT

6 0
3 years ago
Convert A4B from hexadecimal to binary. Show your work.
Rama09 [41]

Answer:

The answer is A4B₁₆ =  2635₁₀ =  101001001011₂

Explanation:

To convert from hexadecimal base system to binary base system, first you can do an intermediate conversion from hexadecimal to decimal using this formula:

where position of the x₁ is the rightmost digit of the number and the equivalents hexadecimal numbers to decimal:

  • A = 10.
  • B = 11.
  • C = 12.
  • D = 13.
  • E = 14.
  • F = 15.

A4B₁₆ = A*16²+4*16¹+B*16⁰ = 2560 + 64 + 11 = 2635₁₀

Now, you have the number transformed from hexadecimal to decimal. To convert the decimal number 2635 to binary: Divide the number repeatedly by 2, keeping track of each remainder, until we get a quotient that is equal to 0:

2635 ÷ 2 = 1317 + 1;

1317 ÷ 2 = 658 + 1;

658 ÷ 2 = 329 + 0;

329 ÷ 2 = 164 + 1;

164 ÷ 2 = 82 + 0;

82 ÷ 2 = 41 + 0;

41 ÷ 2 = 20 + 1;

20 ÷ 2 = 10 + 0;

10 ÷ 2 = 5 + 0;

5 ÷ 2 = 2 + 1;

2 ÷ 2 = 1 + 0;

1 ÷ 2 = 0 + 1;

Now, construct the integer part base 2 representation, by taking the remainders starting from the bottom of the list:

2635₁₀ =  101001001011₂

3 0
3 years ago
Help please i will give Brainliest
steposvetlana [31]

Answer:

ok I've got the answer sheet on the picture I will attach

Explanation:

I had to crop to size on my computer and found them all

8 0
3 years ago
How can I make a video game?
Rainbow [258]
You first need to figure out what kind of game you would like to create. Find codes and certain websites that will help you set up and or make a game.
3 0
3 years ago
Read 2 more answers
How to add links in HTML? ​
saveliy_v [14]

Answer:

<a href="url">link text</a>

6 0
2 years ago
Other questions:
  • Which tool is an easy way to navigate between rows of data in an Access table and is found in the status bar?
    9·1 answer
  • What are some examples of options you can control in the Adjust group to affect an image? (Multiple Choice)
    12·2 answers
  • Define some everyday if else statements you use to determine action. What are the branches of your statement?
    12·1 answer
  • How does the author of let bindi have the limelight persuade readers to consider the importance of wildlife conservation
    9·2 answers
  • Write a recursive function that calculates the sum 11 22 33 ... nn, given an integer value of nin between 1 and 9. You can write
    10·1 answer
  • In many UNIX/Linux data and configuration files are "fields". Sometimes these fields are separated by:
    13·1 answer
  • Java Eclipse homework. I need help coding this
    6·1 answer
  • A ____ is a a set of presentation rules that control how text should look. It is applied to an XML file to change the collection
    9·1 answer
  • Explain how mobile phone production could be more sustainable​
    8·2 answers
  • What is ICT?Write down the uses of ICT​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!