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
Scilla [17]
4 years ago
8

1. Create a class called Name that represents a person's name. The class should have fields named firstName representing the per

son's first name, lastName representing their last name, and middleInitial representing their middle initial (a single character). Your class should contain only fields for now.
2. Add two new methods to the Name class:

public String getNormalOrder()
Returns the person's name in normal order, with the first name followed by the middle initial and last name. For example, if the first name is "John", the middle initial is 'Q', and the last name is "Public", this method returns "John Q. Public".

public String getReverseOrder()
Returns the person's name in reverse order, with the last name preceding the first name and middle initial. For example, if the first name is "John", the middle initial is 'Q', and the last name is "Public", this method returns "Public, John Q.".

(You don't need to write the class header or declare the fields; assume that this is already done for you. Just write your two methods' complete code in the box provided.)
Engineering
2 answers:
beks73 [17]4 years ago
8 0

Answer: Jhon Greenheart

Explanation:

attashe74 [19]4 years ago
4 0

ANSWER:

<u>( 1 )</u><em><u>.</u></em>

<em><u /></em>

public class Name{       //header declaration for the class <em>Name</em>    

   /*

<em>    Declare all necessary fields.</em>

   The first and last names of the person are string variables.

   Hence they are of type String.

   The middle initial of the person is a single character.

   Hence it is of type char.

   */

    String firstName;     // <em>person's first name called firstName</em>

    String lastName;      // <em>person's last name called lastName</em>

    char middleInitial;    // <em>person's middle initial called middleInitial</em>

}

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

<u>( 2 )</u>

/*

Method getNormalOrder() is declared as follows.

It returns the person's name in normal order with first name

followed by the middle initial and last name.

*/

public String getNormalOrder(){      

    // concatenate the firstName, middleInitial and lastName and return the

   // result.

    return this.firstName + " " + this.middleInitial + ". " + this.lastName;

}

/*

Method getReverseOrder() is declared as follows.

It returns the person's name with the last name

followed by the first name and middle initial.

*/

public String getReverseOrder(){

   // concatenate the lastName, lastName and middleInitial  and return the

   // result.

   return this.lastName + " " + this.firstName + " " + this.middleInitial + ".";

}

EXPLANATION:

The above code has been written in Java.

The code contains comments that explain every part of the code. Please go through the comments carefully for a better understanding of the code.

<em>Special note: </em>

i. Concatenation which means joining strings together, is done in Java using the + operator.

ii. The this keyword used in the two methods is optional. It is just used to reference to the instance variables - firstName, lastName and middleInitial - of the object.

<em>Hope this helps!</em>

You might be interested in
A paper clip is made of wire 0.75 mm in diameter. If the original material from which the wire is made is a rod 25 mm in diamete
Mariana [72]

Answer:The right 1 is 25 mm in diameter

Explanation:

6 0
3 years ago
Calculate the thermal efficiency (ηth) for the actual cycle using pump efficiency (ηpump) = 0.85. You’ll need to find the high-p
dangina [55]

Answer:

Thermal efficiency(ηth) = 1 - (TH/Tc), where TH is temperature of hot reservoir and Tc is temperature of cold reservoir.

ηth = 1 - (300/Tc)

We can assume a value for TH to be 400°C

Then,

ηth = 1 - (300/400) = 1 - 0.75 = 0.25

Explanation:

Thermal efficiency, ηth, of an heat engine is define as the ratio of the work it does, W, to the heat input at the high temperature, QH.

The thermal efficiency is expressed mathematically as:

ηth= QH/W

OR

Thermal efficiency(ηth) = 1 - (TH/Tc).

In other words, the fraction of heat that is converted to work is the thermal efficiency. That is, the measure of performance of engines that uses heat energy in their operation. It has no dimension.

Examples of such engines are:

Steam turbine;

Any internal combustion engine;

A refrigerator.

In operation of a refrigeration or heat pumps, thermal efficiency indicates the extent to which the energy added by work is converted to net heat output. Since it is dimensionless number, we must always express W, QH, and QC in the same units

8 0
3 years ago
Read 2 more answers
A 55-μF capacitor has energy ω (t) = 10 cos2 377t J and consider a positive v(t). Determine the current through the capacitor.
mart [117]

Given :

Capacitor , C = 55 μF .

Energy is given by :

\omega(t)=10cos^2 (377t)\ J .

To Find :

The current through the capacitor.

Solution :

Energy in capacitor is given by :

\omega=\dfrac{Cv^2}{2}\\\\v=\sqrt{\dfrac{2\omega}{C}}\\\\v=\sqrt{\dfrac{2\times 10cos^2 (377t)}{55\times 10^{-6}}}\\\\v=cos(337t)\sqrt{\dfrac{2\times 10}{55\times 10^{-6}}}\\\\v=603.02\ cos( 337t)

Now , current i is given by :

i=C\dfrac{dv}{dt}\\\\i=C\dfrac{d[603.02cos(337t)]}{dt}\\\\i=-55\times 10^{-6}\times 603.03\times 337\times sin(337t)\\\\i=-11.18\ sin(337t)

( differentiation of cos x is - sin x )

Therefore , the current through the capacitor is -11.18 sin ( 377t).

Hence , this is the required solution .

6 0
3 years ago
An AC circuit has a resistor, capacitor and inductor in series with a 120 V, 60 Hz voltage source. The resistance of the resisto
aliina [53]

Answer:

(i) 3.5385 ohm, 3.768 ohm (ii) 39.89 A (III) 4773.857 W (vi) 348 var (vii) 0.9973 (viii) 4.1796°

Explanation:

We have given voltage V =120 volt

Frequency f=60 Hz

Resistance R =3 ohm

Inductance L =0.01 H

Capacitance C =0.00075 farad

(i) reactance of of inductor X_L=\omega L=2\pi fL=2\times 3.14\times 60\times 0.01=3.768ohm

X_C=\frac{1}{\omega C}=\frac{1}{2\times 3.14\times 60\times 0.00075}=3.5385ohm

(ii) Total impedance Z=\sqrt{R^2+(X_L-X_C)^2}=\sqrt{3^2+(3.768-3.5385)^2}=3.008ohm

Current i=\frac{V}{Z}=\frac{120}{3.008}=39.89A

(viii) power factor cos\Phi =\frac{R}{Z}=\frac{3}{3.008}=0.9973

(VII) cos\Phi =0.9973

\Phi =4.1796^{\circ}

So power factor angle is 4.1796°

(iii) Apparent power P=VICOS\Phi =120\times 39.89\times 0.9973=4773.875W

(vi) Reactive power Q=VISIN\Phi =120\times 39.89\times SIN4.17^{\circ}=348var

5 0
3 years ago
2 Describe the four major disciplines of engineering and identify problems or projects that an engineer in each discipline might
Harman [31]
Answer: Starting of with Chemical Engineering something that they may encounter is a lack of adeptness man puissance. People that are working there are not much adept or having cognizance regarding to chemical industry. Something someone with a Civil engineering might encounter is the quandary of sustainable construction, and amendment construction site safety. To go on , something that Electrical engineering might encounter is a Non technical , Virtually an electrical engineer has to deal with an astronomical range of machines , control panels,instruments. For example you are working with circuit breakers,as anon as you’ll have expertise on any particular type of circuit breaker, there's a transmutation in trend and the CB you are working with is already obsolete. And last but no least , Something someone might encounter while doing Mechanical engineering is there toxic substances because their work environment is susceptible to fires, explosions, structural failures and equipment malfunctions.
5 0
3 years ago
Other questions:
  • Naturally, it would be nice to convert the entire output of make-change to the RLE format. Write a SCHEME function (rle-all lcoi
    14·1 answer
  • The function of a circuit breaker is to _____.
    12·1 answer
  • Three return steam lines in a chemical processing plan enter a collection tank operating at a steady state at 1 bar. Steam enter
    11·1 answer
  • Technician A says a "dry park check" is a good way to check ball joints and control arm bushings for looseness. Technician B say
    15·2 answers
  • An ant starts at one edge of a long strip of paper that is 34.2 cm wide. She travels at 1.3 cm/s at an angle of 61◦ with the lon
    10·1 answer
  • Barry wants to convert mechanical energy into electric energy. What can he use?
    5·2 answers
  • Which of the following conditions would completely shut down a circuit
    10·1 answer
  • Segment AB is congruent to segment AB.<br><br> This statement shows the ______ property.
    7·1 answer
  • (25%) A well-insulated compressor operating at steady state takes in air at 70 oF and 15 psi, with a volumetric flow rate of 500
    12·1 answer
  • How to calculate tension.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!