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
Arturiano [62]
3 years ago
11

For this question you must write a java class called Rectangle and a client class called RectangleClient. The partial Rectangle

class is given below. (For this assignment, you will have to submit 2 .java files: one for Rectangle class and the other one for RectangleClient class.) // A Rectangle stores an (x, y) coordinate of its top/left corner, its width and height. public class Rectangle { private int x; private int y; private int width; private int height; // constructs a new Rectangle with the given inX, inY and inSideLength public Rectangle(int inX, int inY, int inWidth, int inHeight) // returns the fields' values public int
Engineering
1 answer:
Alex Ar [27]3 years ago
6 0

Answer:

Java program is given below. You can get .class after you execute java programs, You can attach those files along with .java classes given , Those .class files are generated ones.

Explanation:

//Rectangle.java class

public class Rectangle {

private int x;

private int y;

private int width;

private int height;

// constructs a new Rectangle with the given x,y, width, and height

public Rectangle(int x, int y, int w, int h)

{

this.x=x;

this.y=y;

this.width=w;

this.height=h;

}

// returns the fields' values

public int getX()

{

return x;

}

public int getY()

{

return y;

}

public int getWidth()

{

return width;

}

public int getHeight()

{

return height;

}

// returns a string such as “Coordinate is (5,12) and dimension is 4x8” where 4 is width and 8 is height. public String toString()

public String toString()

{

String str="";

//add x coordidate , y-coordinate , width, height and area to str and return

str+="Coordinate is ("+x+","+y+")";

str+=" and dimension is : "+width+"x"+height;

str+=" Area is "+(width*height);

return str;

}

public void changeSize(int w,int h)

{

width=w;

height=h;

}

}

======================

//main.java

class Main {

public static void main(String[] args) {

//System.out.println("Hello world!");

//create an object of class Rectangle

Rectangle rect=new Rectangle(5,12,4,8);

//print info of rect using toString method

System.out.println(rect.toString());

//chamge width and height

rect.changeSize(3,10);

//print info of rect using toString method

System.out.println(rect.toString());

}

}

==========================================================================================

//Output

Coordinate is (5,12) and dimension is : 4x8 Area is 32

Coordinate is (5,12) and dimension is : 3x10 Area is 30

========================================================================================

You might be interested in
Sorry here is my second one
lesya692 [45]

Answer:

brainlyest if it right and sorry if it was wrong

Explanation:

1:a

2:b

3:a

4:a

5:c

6:a

4 0
3 years ago
Suppose that a one-celled organism can be in one of two states – either A or B. An individual in state A will change to state B
xxTIMURxx [149]

Answer:

P{x,y} {x - 1, y + 1} = βy/ αx + βy.

P{x,y} {x + 1, y - 1} = βx/ αx + βy.

Explanation:

The full meaning for the acronym "CTMC" given in the question is known as the continuous-time Markov chain. The continuous-time Markov chain is an important tool or instrument which is used in the dealings with stochastic process.

Hence, Xa(t) is the number of organisms in state A, Xb(t) is the number of organisms in state B. Therefore, we can say that the continuous-time Markov chain(CTMC) is;

{ Xa(t), Xb(t)}.

Thus, b(x,y) = αx + βy.

Therefore, we will have;

P{x,y} {x - 1, y + 1} = βy/ αx + βy.

P{x,y} {x + 1, y - 1} = βx/ αx + βy.

Note that, if we are to use the generation of matrix to get differential equation as below;

I(x)α(ix - 1, iy + 1) (JxJy)(t) + iyβ

P (ix + 2, iy -1) (Jx,Jy) (t) - (ixα + iyβ) P(ix,iy)(JxJy) (t).

t is greater or equals to zero for ix,iy, Jx and Jy.

3 0
3 years ago
we wish to send at a rate of 10Mbits/s over a passband channel. Assuming that an excess bandwidth of 50% is used, how much bandw
gayaneshka [121]

Answer:

QPSK: 7.5 MHz

64-QAM:2.5 MHz

64-Walsh-Hadamard: 160 MHz

Explanation:

See attached picture.

6 0
3 years ago
More discussion about seriesConnect(Ohm) function In your main(), first, construct the first circuit object, called ckt1, using
STALIN [3.7K]

Answer:

resistor.h

//circuit class template

#ifndef TEST_H

#define TEST_H

#include<iostream>

#include<string>

#include<vector>

#include<cstdlib>

#include<ctime>

#include<cmath>

using namespace std;

//Node for a resistor

struct node {

  string name;

  double resistance;

  double voltage_across;

  double power_across;

};

//Create a class Ohms

class Ohms {

//Attributes of class

private:

  vector<node> resistors;

  double voltage;

  double current;

//Member functions

public:

  //Default constructor

  Ohms();

  //Parameterized constructor

  Ohms(double);

  //Mutator for volatage

  void setVoltage(double);

  //Set a resistance

  bool setOneResistance(string, double);

  //Accessor for voltage

  double getVoltage();

  //Accessor for current

  double getCurrent();

  //Accessor for a resistor

  vector<node> getNode();

  //Sum of resistance

  double sumResist();

  //Calculate current

  bool calcCurrent();

  //Calculate voltage across

  bool calcVoltageAcross();

  //Calculate power across

  bool calcPowerAcross();

  //Calculate total power

  double calcTotalPower();

  //Display total

  void displayTotal();

  //Series connect check

  bool seriesConnect(Ohms);

  //Series connect check

  bool seriesConnect(vector<Ohms>&);

  //Overload operator

  bool operator<(Ohms);

};

#endif // !TEST_H

resistor.cpp

//Implementation of resistor.h

#include "resistor.h"

//Default constructor,set voltage 0

Ohms::Ohms() {

  voltage = 0;

}

//Parameterized constructor, set voltage as passed voltage

Ohms::Ohms(double volt) {

  voltage = volt;

}

//Mutator for volatage,set voltage as passed voltage

void Ohms::setVoltage(double volt) {

  voltage = volt;

}

//Set a resistance

bool Ohms::setOneResistance(string name, double resistance) {

  if (resistance <= 0){

      return false;

  }

  node n;

  n.name = name;

  n.resistance = resistance;

  resistors.push_back(n);

  return true;

}

//Accessor for voltage

double Ohms::getVoltage() {

  return voltage;

}

//Accessor for current

double Ohms::getCurrent() {

  return current;

}

//Accessor for a resistor

vector<node> Ohms::getNode() {

  return resistors;

}

//Sum of resistance

double Ohms::sumResist() {

  double total = 0;

  for (int i = 0; i < resistors.size(); i++) {

      total += resistors[i].resistance;

  }

  return total;

}

//Calculate current

bool Ohms::calcCurrent() {

  if (voltage <= 0 || resistors.size() == 0) {

      return false;

  }

  current = voltage / sumResist();

  return true;

}

//Calculate voltage across

bool Ohms::calcVoltageAcross() {

  if (voltage <= 0 || resistors.size() == 0) {

      return false;

  }

  double voltAcross = 0;

  for (int i = 0; i < resistors.size(); i++) {

      voltAcross += resistors[i].voltage_across;

  }

  return true;

}

//Calculate power across

bool Ohms::calcPowerAcross() {

  if (voltage <= 0 || resistors.size() == 0) {

      return false;

  }

  double powerAcross = 0;

  for (int i = 0; i < resistors.size(); i++) {

      powerAcross += resistors[i].power_across;

  }

  return true;

}

//Calculate total power

double Ohms::calcTotalPower() {

  calcCurrent();

  return voltage * current;

}

//Display total

void Ohms::displayTotal() {

  for (int i = 0; i < resistors.size(); i++) {

      cout << "ResistorName: " << resistors[i].name << ", Resistance: " << resistors[i].resistance

          << ", Voltage_Across: " << resistors[i].voltage_across << ", Power_Across: " << resistors[i].power_across << endl;

  }

}

//Series connect check

bool Ohms::seriesConnect(Ohms ohms) {

  if (ohms.getNode().size() == 0) {

      return false;

  }

  vector<node> temp = ohms.getNode();

  for (int i = 0; i < temp.size(); i++) {

      this->resistors.push_back(temp[i]);

  }

  return true;

}

//Series connect check

bool Ohms::seriesConnect(vector<Ohms>&ohms) {

  if (ohms.size() == 0) {

      return false;

  }

  for (int i = 0; i < ohms.size(); i++) {

      this->seriesConnect(ohms[i]);

  }

  return true;

}

//Overload operator

bool Ohms::operator<(Ohms ohms) {

  if (ohms.getNode().size() == 0) {

      return false;

  }

  if (this->sumResist() < ohms.sumResist()) {

      return true;

  }

  return false;

}

main.cpp

#include "resistor.h"

int main()

{

   //Set circuit voltage

  Ohms ckt1(100);

  //Loop to set resistors in circuit

  int i = 0;

  string name;

  double resistance;

  while (i < 3) {

      cout << "Enter resistor name: ";

      cin >> name;

      cout << "Enter resistance of circuit: ";

      cin >> resistance;

      //Set one resistance

      ckt1.setOneResistance(name, resistance);

      cin.ignore();

      i++;

  }

  //calculate totalpower and power consumption

  cout << "Total power consumption = " << ckt1.calcTotalPower() << endl;

  return 0;

}

Output

Enter resistor name: R1

Enter resistance of circuit: 2.5

Enter resistor name: R2

Enter resistance of circuit: 1.6

Enter resistor name: R3

Enter resistance of circuit: 1.2

Total power consumption = 1886.79

Explanation:

Note

Please add all member function details.Its difficult to figure out what each function meant to be.

8 0
3 years ago
An aircraft is flying at 300 mph true airspeed has a 50 mph tailwind. What is its ground speed?
Free_Kalibri [48]

Answer:

304.13 mph

Explanation:

Data provided in the question :

The Speed of the flying aircraft = 300 mph

Tailwind of the true airspeed = 50 mph

Now,

The ground speed will be calculated as:

ground speed = \sqrt{300^2+50^2}

or

The ground speed = \sqrt{92500}

or

The ground speed = 304.13 mph

Hence, the ground speed is 304.13 mph

8 0
4 years ago
Other questions:
  • Water discharging into a 10-m-wide rectangular horizontal channel from a sluice gate is observed to have undergone a hydraulic j
    14·1 answer
  • A stream of vinyl chloride monomer (VCM, H2C=CHCl, molecular weight = 62.5lb/lb-mol) in air is being produced from a process to
    7·1 answer
  • Consider a variant of the thermostat of example 3.5. In this variant, there is only one temperature threshold, and to avoid chat
    6·2 answers
  • Does the Diesel engine have engine knock or detonation problem? Why?
    6·1 answer
  • Why is tesla better than Edison
    11·1 answer
  • What is a rivet and how do tehey work
    14·1 answer
  • You are NASA. Build a space station on Mars that could support humans to live in for an extended period of time.
    9·1 answer
  • Anyone can solve this answer.please
    13·1 answer
  • hey will you be a friend to my best her name is alexzicancelperez she has only one friend and that me can please be her friend a
    5·2 answers
  • 7. Technician A says grease is valued for its ability to stay on parts for a long time. Technician B says grease is valued for i
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!