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

Write in Java please

Computers and Technology
1 answer:
Mariulka [41]3 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
Word can only print documents on one size of paper.<br><br> True or false
Elena L [17]

Answer:

False

Explanation:

You can always go in the document settings to change the layout and make the paper wider (landscape).

Layout > Orientation

Choose portrait or landscape

5 0
2 years ago
What was the pascaline used for?​
Alex_Xolod [135]

Answer:

Math like multiplication, addition, division, and subtraction

3 0
2 years ago
Cuál es la diferencia entre hackeo y crackeo
Sauron [17]

Answer: El hackeo es el proceso de intrusión en los sistemas informáticos sin autorización para acceder a ellos, con buenos o malos propósitos, el cracking es la misma práctica aunque con intención delictiva.

3 0
3 years ago
In the application development area, ____________ often refers to bringing together various sources of data to create a new prod
Vinvika [58]

Answer:

mashup

Explanation:

In the application development area, mashup often refers to bringing together various sources of data to create a new product with unique value.

8 0
2 years ago
How could you represent the following binary color in hexadecimal? What is its numerical value? What color is it? How
Radda [10]

Answer:

White, the color value is 0xFFFFFF

Explanation:

Each segment is 8-bits, which totals to 255 in base-10 value, or 0xFF in hexadecimal.

11111111₂ == 255₁₀ == 0xFF₁₆

so

 Red    Green   Blue

11111111  11111111  11111111

 FF         FF        FF

When all 3 color values are turned on at max value (255), they produce white.

7 0
2 years ago
Other questions:
  • What does bam file stand for computer terms?
    9·1 answer
  • Which of the following is not considered as part of technology literacy?
    8·1 answer
  • How many apostrophes or quotation marks in a row should you use to begin and end a multi-line string?
    14·2 answers
  • In some cases, certain Hyper-V guest operating system features do not function properly using the operating system's own device
    9·1 answer
  • What is the WiFi signal strength in different iPhone models?
    7·1 answer
  • A class is a _____, which encapsulates _____ and _____. (Points : 2) programming language construct; attributes; behavior
    7·1 answer
  • The Internet began when a large company wanted to sell products online.
    11·2 answers
  • Write a paragraph discussing privacy issues on the internet<br> and their impact on human lives.
    9·1 answer
  • ________ helps in determining the cause of a security threat in an incident response plan. Question 7 options: A) Restricting sy
    5·1 answer
  • quizlet ann is a security professional for a midsize business and typically handles log analysis and security monitoring tasks f
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!