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
Which of the following is a reason why the comments tool within PDF documents could be helpful? (Select all that apply.)
sveta [45]
You can use it to suggest edits for the document.

You can use it to make a note of clarification for someone else examining the document.

You can use it to cover up mistakes within the document.

That's what I think.
7 0
3 years ago
Is this photo considered rim photography
xenn [34]

Answer:

No

Explanation:

The photo in the question is just a black and white filter whereas in Rim photo, the image subject is backlit and the image is exposed to hide the subject features in shadow.

An example of Rim photography.

7 0
3 years ago
Is a book considered technology?
kumpel [21]
Yes, "technology" doesn't have to be all about computers or cell phones.. Technology is anything that is a new advance in knowledge and books were once a great advance in that field.
7 0
3 years ago
Read 2 more answers
Which organization safeguards americans from health, safety, and security hazards and threats?
Mrrafil [7]

OSHA (Occupational Safety and Health Administration)

4 0
3 years ago
Read 2 more answers
Define operating system?explain the types of operating system on the basis of use.​
GalinKa [24]

Answer:

An operating system is a software that helps the any computers basic needs or functions.  For example, the windows on a computer is a operating system.

Explanation:

4 0
2 years ago
Other questions:
  • What is authentication?
    8·1 answer
  • Assume that
    7·1 answer
  • A collision volume is called ____
    7·1 answer
  • The four basic stucture of computer are input processing output and storage true or false
    15·1 answer
  • As a load is mechanically lifted, the materials ____________________.
    7·1 answer
  • What items do you keep in a data base
    5·1 answer
  • Write a CPP Program to read an integer number. Use a pointer to display this numbe
    5·1 answer
  • Which of the following statements is correct?
    11·1 answer
  • Which is not a factor that leads to technological advancement?
    8·1 answer
  • Can someone explain what Bytes are? I would really like to know.
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!