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
A manufacturer has been asked to produce 100 customized metal discs with a particular pattern engraved on them. Which production
topjm [15]
I’m just here for points because I have test and I need them lol
8 0
3 years ago
Read 2 more answers
The A/C compressor will not engage when the A/C is turned on. The static refrigerant pressure is 75 psi and the outside temperat
VikaD [51]

In the case above,  poor connection at the pressure cycling switch  and also a faulty A/C clutch coil could be the cause.

<h3>What is likely the reason when an A/C compressor will not engage if A/C is turned on?</h3>

The cause that hinders the A/C Compressor from engaging are:

  • Due to low pressure lockout.
  • Due to a poor ground
  • Due to bad clutch coil.
  • Dur to an opening in the wire that links to the clutch coil.
  • Due to a blown fuse.

Note that the pressure switches is known to be one that control the on/off function of any kind of AC compressor and as such, if there is switch failure, it can hinder the AC compressor from functioning at all.

Therefore, technician A and B are correct.

Learn more about refrigerant pressure from

brainly.com/question/10054719

#SPJ1

3 0
2 years ago
When framing a building, a simple way to estimate the total amount of wall studs needed is to allow
Levart [38]
1+1=2
Solution
3:932(2)=61
4 0
3 years ago
The unit weight of a soil is 14.9kN/m3. The moisture content of the soil is17% when the degree of saturation is 60%. Determine:
Serggg [28]

Answer:

a) 2622.903 N/m^3

b) 1.38233

c)4.878811765

Explanation:

Find the void ratio using the formula:

y = \frac{G_{s}*y_{w} + w*G_{s}*y_{w} }{1+e} ....... Eq1

Here;

G_{s} is specific gravity of soil solids

y_{w} is unit weight of water = 998 kg/m^3

w is the moisture content = 0.17

e is the void ratio

y is the unit weight of soil = 14.9KN/m^3

Saturation Ratio Formula:

w*G_{s} = S*e  ..... Eq2

S is saturation rate

Substitute Eq 2 into Eq 1

y = \frac{(\frac{S*e}{w}) * y_{w} + S*e*y_{w}  }{1+e}

14900 = \frac{3522.352941*e + 598.8*e }{1+e} = \frac{4121.152941*e}{1+e}\\\\ e= 1.38233

Specific gravity of soil solids

G_{s} = \frac{S*e}{w} = \frac{0.6*1.38233}{0.17} = 4.878811765

Saturated Unit Weight

y_{s} = \frac{(G_{s} + e)*y_{w}  }{1+e} \\=\frac{(4.878811765 + 1.38233)*998  }{1+1.38233}\\\\= 2622.902571 N/m^3

7 0
3 years ago
When the Moon is in the position shown, how would the Moon look to an observer on the North Pole?
kirill115 [55]

Answer:

cant see the moon sorry dude

5 0
3 years ago
Other questions:
  • To be able to write an ss-domain equation for a circuit, use partial fraction decomposition to separate the terms in this equati
    12·1 answer
  • Calculate the value of ni for gallium arsenide (GaAs) at T = 300 K. The constant B = 3. 56 times 1014 9cm -3 K-3/2) and the band
    9·1 answer
  • If a building is too humid, what harmful substance may be stored there?
    13·2 answers
  • When choosing a respirator for your job, you must conduct a _____ test.
    15·1 answer
  • Wastewater flows into a once it is released into A floor drain
    11·1 answer
  • A DNS record that's used to redirect traffic from one domain name to another is known as a _______ record.
    11·1 answer
  • An engine jack is used to lift a 265-lb engine 6'. How much work, in ft-lb, is performed?
    11·1 answer
  • Orbit is to _____ as altitude is to _____.
    13·2 answers
  • At least 1 sources must be from an organization website (.org) and 1 source must be from and educational website .edu) Do not us
    7·1 answer
  • Explain how to properly engage the safety latches on the Stan Design Pit Jack.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!