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
Which 1 of the following did women NOT do during WWII?
Anastaziya [24]

Answer:

Didn't do what, there are no women as answers. Contact me and give me the women.

Explanation:

3 0
3 years ago
Read 2 more answers
Consider a space shuttle weighing 100 kN. It is travelling at 310 m/s for 30 minutes. At the same time, it descends 2200 m. Cons
mixas84 [53]

Answer:

work done = 48.88 × 10^{9} J

Explanation:

given data

mass = 100 kN

velocity =  310 m/s

time = 30 min = 1800 s

drag force = 12 kN

descends = 2200 m

to find out

work done by the shuttle engine

solution

we know that work done here is

work done = accelerating work - drag work - descending work

put here all value

work done = ( mass ×velocity ×time  - force ×velocity ×time  - mass ×descends )  10³ J

work done = ( 100 × 310 × 1800  - 12×310 ×1800  - 100 × 2200 )  10³ J

work done = 48.88 × 10^{9} J

6 0
3 years ago
3. This material is considered flammable.
almond37 [142]

Answer:

All of the above

Explanation:

Most of materials are flammable because of the chemicals theyre made up of.  Most materials that are bought say to keep them at room temature for a reason.

4 0
2 years ago
Read 2 more answers
tech A says that a Hall-effect sensor can be used in an electronic ignition system. Tech B says that an optical-type sensor can
Alex

Answer:

<em>Both Tech A and Tech B are correct.</em>

<em>Explanation:</em>

<em>The Hall effect sen sensor are used to control displacements and rotations of various body components  of the vehicles, engine vibrations , and the ignition   system</em>

<em>The  optical-type sensor converts rays of light  into electronic signals. It measures the quantity physically of which the translates to a form that is understandable or readable  by an instrument. An optical sensor is larger part of a  system that integrates light sources, a device for measuring  and the optical sensor, which therefore is usually  connected to an electrical trigger.</em>

6 0
3 years ago
Given a 12-bit A/D converter operating over a voltage range from ????5 V to 5 V, how much does the input voltage have to change,
Doss [256]

Answer:

2.44 mV

Explanation:

This question has to be one of analog quantization size questions and as such, we use the formula

Q = (V₂ - V₁) / 2^n

Where

n = 12

V₂ = higher voltage, 5 V

V₁ = lower voltage, -5 V

Q = is the change in voltage were looking for

On applying the formula and substitutiting the values we have

Q = (5 - -5) / 2^12

Q = 10 / 4096

Q = 0.00244 V, or we say, 2.44 mV

6 0
3 years ago
Other questions:
  • A 50-lbm iron casting, initially at 700o F, is quenched in a tank filled with 2121 lbm of oil, initially at 80o F. The iron cast
    9·1 answer
  • in a vehicle you're servicing the fuel pressure drops rapidly when the engine is says that one or more turned off. Technician a
    7·1 answer
  • WHAT IS A TOROID IN HYDRAULUCS?
    11·2 answers
  • According to the eNotes, a program that eliminates sales and promotions in an effort to minimize the bullwhip effect would be ca
    13·1 answer
  • A. A compound gear train is composed of four gears: E,F,G,H. Gear E has 15 teeth and is meshed with gear F. Gear F has 25 teeth
    11·1 answer
  • Excessive looseness in steering and suspension components can cause _____
    13·1 answer
  • What are the nine Historical periods?
    9·1 answer
  • Special certification is required for technicians who handle which of the following systems?
    10·1 answer
  • Dampness or moisture introduces ____ into the weld, which causes cracking when some metals are welded.
    7·1 answer
  • Invent five new communication method wired or wireless you think would be practical
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!