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

Answer: Jhon Greenheart

Explanation:

attashe74 [19]3 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
According to the Bureau of Labor Statistics, which occupation employed 4.2 million people – more than any other occupation – in
Ludmilka [50]

Answer:

Retail Salespersons

Explanation:

The Bureau of Labor Statistics or the BLS in short is the federal unit or agency of the United States Labor Department. It is the main stats finding agency of the United States federal government in the field of statistics and labor economics.

According to a publication published by the Labor Statistics Bureau, the retail salesperson sector of occupation employed the most people in the U.S. in the year 2010. It provided employment to about 4.2 million people.

5 0
3 years ago
What are things that need to be considered with respect to the environment when design and construction is occurring?
Law Incorporation [45]

Answer:

If you are destroying the environment or habitats or trees. Also if people live nearby. Also if its legal.

Explanation:

8 0
3 years ago
Steam enters a turbine from a 2 inch diameter pipe, at 600 psia, 930 F, with a velocity of 620 ft/s. It leaves the turbine at 12
Katarina [22]

Answer:

\dot W_{out} = 3374.289\,\frac{BTU}{s}

Explanation:

The model for the turbine is given by the First Law of Thermodynamics:

- \dot W_{out} + \dot m \cdot (h_{in} - h_{out}) = 0

The turbine power output is:

\dot W_{out} = \dot m\cdot (h_{in}-h_{out})

The volumetric flow is:

\dot V = \frac{\pi}{4} \cdot \left( \frac{2}{12}\,ft \right)^{2}\cdot (620\,\frac{ft}{s} )

\dot V \approx 13.526\,\frac{ft^{3}}{s}

The specific volume of steam at inlet is:

State 1 (Superheated Steam)

\nu = 1.33490\,\frac{ft^{3}}{lbm}

The mass flow is:

\dot m = \frac{\dot V}{\nu}

\dot m = \frac{13.526\,\frac{ft^{3}}{s} }{1.33490\,\frac{ft^{3}}{lbm} }

\dot m = 10.133\,\frac{lbm}{s}

Specific enthalpies at inlet and outlet are, respectively:

State 1 (Superheated Steam)

h = 1479.74\,\frac{BTU}{lbm}

State 2 (Saturated Vapor)

h = 1146.1\,\frac{BTU}{lbm}

The turbine power output is:

\dot W_{out} = (10.133\,\frac{lbm}{s} )\cdot (1479.1\,\frac{BTU}{lbm}-1146.1\,\frac{BTU}{lbm})

\dot W_{out} = 3374.289\,\frac{BTU}{s}

6 0
3 years ago
technician A says that incandescent bulbs resist vibration well. Technician B says that HID headlamps require up to approximatel
bekas [8.4K]

Answer:

Both a and b.

Explanation:

HID headlamps require high voltage ignition to start just like street lamps. It requires almost 25,000 volts to start HID head lamps but require only 80 to 90 volts to keep it operating.

6 0
3 years ago
A multipurpose transformer has a secondary coil with several points at which a voltage can be extracted, giving outputs of 5.60,
WITCHER [35]

Answer:

Explanation:

A multipurpose transformer can act as step up as well as step down transformer according to the desired setting by a user.

When the voltage at the output is greater than the voltage at the input of the transformer then it acts as step-up transformer and vice-versa acting is a step down transformer.

Given that:

input (primary) voltage of the transformer, V_i=220~V

no. of turns in the primary coil, N_i=230

  • When the output voltage is 5.60 V:

V_o=5.60~V

\frac{N_i}{N_o} =\frac{V_i}{V_o}

\frac{N_o}{230}=\frac{5.60}{220}

N_o=5.85\approx 6 turns compensating the losses

  • When the output voltage is 12.0 V:

V_o=12.0~V

\frac{N_i}{N_o} =\frac{V_i}{V_o}

\frac{N_o}{230}=\frac{12.0}{220}

N_o=12.45\approx 13 turns compensating the losses

  • When the output voltage is 480 V:

V_o=480~V

\frac{N_i}{N_o} =\frac{V_i}{V_o}

\frac{N_o}{230}=\frac{480}{220}

N_o=501.8\approx 502 turns compensating the losses

5 0
3 years ago
Other questions:
  • A freshwater jet boat takes in water through side vents and ejects it through a nozzle of diameter D = 75 mm; the jet speed is V
    5·1 answer
  • What engine does the Lexus is300 have?
    5·1 answer
  • Assume the following LTI system where the input signal is an impulse train (i.e.,x(t)=∑????(t−nT0)[infinity]n=−[infinity].a)Find
    10·1 answer
  • A water tower that is 90 ft high provides water to a residential subdivision. The water main from the tower to the subdivision i
    10·1 answer
  • Give the approximate temperature at which creep deformation becomes an important consideration for each of the following metals:
    5·1 answer
  • A glass bottle washing facility uses a well agitated hot water bath at 50°C with an open top that is placed on the ground. The b
    12·1 answer
  • What process is used to remove collodal and dissolved organic matter in waste water ​
    10·1 answer
  • HELP ME PLEASE RN
    8·1 answer
  • What are the well-known effects of electricity​
    11·2 answers
  • Find At Least Three Instances Of Set Constructions In Your CS Courses And Use Them To Exhibit All Set Operations Discussed In Cl
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!