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
DUE AT 3:00!!!!!
emmainna [20.7K]
It is heat because that is what made the tires lose air
5 0
3 years ago
Read 2 more answers
An object whose mass is 251 kg is located at an elevation of 24 m above the surface of the earth. For g-9.78 ms, determine the g
Harlamova29_29 [7]

Answer:

Gravitational Potential =58.914 KJ

Explanation:

We know that

Gravitational Potential Energy = mass\times g\times Height

Given mass = 251 kg

Height= 24 m

g is acceleration due to gravity = 9.78m/s^{2}

Applying values in the equation we get

Gravitational Potential Energy=251X9.78X24 Joules

Gravitational Potential Energy=58914.72 Joules

Gravitational Potential Energy =\frac{58914.72}{1000}KJ= 58.914KJ

4 0
4 years ago
The lift on a spinning circular cylinder in a freestream with a velocity of 30 m/s and at standard sea level conditions is 6 N/m
Evgesh-ka [11]

Answer:

The circulation around the cylinder is 0.163 \frac{m^{2} }{s}

Explanation:

Given :

Velocity of spinning cylinder v = 30 \frac{m}{s}

Sea level density \rho = 1.23 \frac{kg}{m^{3} }

Sea level span L = 6 \frac{N}{m}

Lift per unit circulation is given by,

  L = \rho v c

Where c = circulation around cylinder

   c = \frac{L}{\rho v}

   c = \frac{6}{1.23 \times 30}

   c = 0.163 \frac{m^{2} }{s}

Therefore, the circulation around the cylinder is 0.163 \frac{m^{2} }{s}

5 0
4 years ago
Drivers killed in speed related accidents usually have a history of_______
bazaltina [42]
I would go with C but i am not 100 percent on that
3 0
3 years ago
Read 2 more answers
Select the correct text in the passage.
sineoko [7]
It is habahi Yw with yuuuuuy I am a little more confused about
5 0
3 years ago
Read 2 more answers
Other questions:
  • In the combination of resistors above, consider the 1.50 µΩ and 0.75 µΩ. How can you classify the connection between these two r
    6·1 answer
  • A part has been tested to have Sut = 530 MPa, f = 0.9, and a fully corrected Se = 210 MPa. The design requirements call for the
    10·1 answer
  • View the picture below and then correctly answer the questions using the following words: Temperate Zone, Tropical Zone, Polar Z
    6·2 answers
  • What do you do if building doesn't have enough water pressure for sprinklers? a. Increase pipe size b. Adjust budget to accommod
    15·1 answer
  • A _______ contact allows current to flow when the switch's operator is not activated.?
    6·1 answer
  • If a tapered roller bearing is adjusted to loose, the bearing will bind and overheat.
    11·1 answer
  • What is the difference between POP3 and IMAP?
    5·1 answer
  • Technician A says that to depressurize high-pressure components of the electronic brake control (EBC) system, research the proce
    13·1 answer
  • Describe how to mix and apply body filler?
    13·1 answer
  • In-------process the hot drawn bar or rod is pulled through the die.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!