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
Write a method printShampooInstructions(), with int parameter numCycles, and void return type. If numCycles is less than 1, prin
kirill [66]

Answer:

// The method is defined with a void return type

// It takes a parameter of integer called numCycles

// It is declared static so that it can be called from a static method

public static void printShampooInstructions(int numCycles){

// if numCycles is less than 1, it display "Too few"

   if (numCycles < 1){

       System.out.println("Too few.");

   }

// else if numCycles is less than 1, it display "Too many"

    else if (numCycles > 4){

       System.out.println("Too many.");

   }

// else it uses for loop to print the number of times to display

// Lather and rinse

  else {

       for(int i = 1; i <= numCycles; i++){

           System.out.println(i + ": Lather and rinse.");

       }

       System.out.println("Done");

       

   }

}

Explanation:

The code snippet is written in Java. The method is declared static so that it can be called from another static method. It has a return type of void. It takes an integer as parameter.

It display "Too few" if the passed integer is less than 1. Or it display "Too much" if the passed integer is more than 4. Else it uses for loop to display "Lather and rinse" based on the passed integer.

8 0
3 years ago
2. There are three drawings that architects and designers use to indicate spaces. What are these drawing?
Zarrin [17]

Answer:

Architectural plans.

Explanation:

An architectural plan is called the drawings made by architects, civil engineers or designers of spaces or interiors, in which these professionals capture their building projects, organizing the distribution of the spaces to be used, the elements to be located in them and, fundamentally, to give construction planning a projection into reality. Thus, the plans help professionals to have a better understanding of the expected end result of the projects they are carrying out.

3 0
3 years ago
A large particle composite consisting of tungsten particles within a copper matrix is to be prepared. If the volume fractions of
OverLord2011 [107]

Answer:

Upper bounds 22.07 GPa

Lower bounds 17.59 GPa

Explanation:

Calculation to estimate the upper and lower bounds of the modulus of this composite.

First step is to calculate the maximum modulus for the combined material using this formula

Modulus of Elasticity for mixture

E= EcuVcu+EwVw

Let pug in the formula

E =( 110 x 0.40)+ (407 x 0.60)

E=44+244.2 GPa

E=288.2GPa

Second step is to calculate the combined specific gravity using this formula

p= pcuVcu+pwTw

Let plug in the formula

p = (19.3 x 0.40) + (8.9 x 0.60)

p=7.72+5.34

p=13.06

Now let calculate the UPPER BOUNDS and the LOWER BOUNDS of the Specific stiffness

UPPER BOUNDS

Using this formula

Upper bounds=E/p

Let plug in the formula

Upper bounds=288.2/13.06

Upper bounds=22.07 GPa

LOWER BOUNDS

Using this formula

Lower bounds=EcuVcu/pcu+EwVw/pw

Let plug in the formula

Lower bounds =( 110 x 0.40)/8.9+ (407 x 0.60)/19.3

Lower bounds=(44/8.9)+(244.2/19.3)

Lower bounds=4.94+12.65

Lower bounds=17.59 GPa

Therefore the Estimated upper and lower bounds of the modulus of this composite will be:

Upper bounds 22.07 GPa

Lower bounds 17.59 GPa

7 0
2 years ago
At a point on the free surface of a stressed body, the normal stresses are 20 ksi (T) on a vertical plane and 30 ksi (C) on a ho
victus00 [196]

Answer:

The principal stresses are σp1 = 27 ksi, σp2 = -37 ksi and the shear stress is zero

Explanation:

The expression for the maximum shear stress is given:

\tau _{M} =\sqrt{(\frac{\sigma _{x}^{2}-\sigma _{y}^{2}  }{2})^{2}+\tau _{xy}^{2}    }

Where

σx = stress in vertical plane = 20 ksi

σy = stress in horizontal plane = -30 ksi

τM = 32 ksi

Replacing:

32=\sqrt{(\frac{20-(-30)}{2} )^{2} +\tau _{xy}^{2}  }

Solving for τxy:

τxy = ±19.98 ksi

The principal stress is:

\sigma _{x}+\sigma _{y} =\sigma _{p1}+\sigma _{p2}

Where

σp1 = 20 ksi

σp2 = -30 ksi

\sigma _{p1}  +\sigma _{p2}=-10 ksi (equation 1)

\tau _{M} =\frac{\sigma _{p1}-\sigma _{p2}}{2} \\\sigma _{p1}-\sigma _{p2}=2\tau _{M}\\\sigma _{p1}-\sigma _{p2}=32*2=64ksi equation 2

Solving both equations:

σp1 = 27 ksi

σp2 = -37 ksi

The shear stress on the vertical plane is zero

4 0
3 years ago
Driving Distraction Brainstorming Session
Leto [7]

texting, phone calls, putting on makeup, brushing hair, movies playing in car, loud music, children, and that's pretty much all I could think of

please give <u>BRAINLIEST ANSWER └[T‸T]┘</u>

5 0
3 years ago
Other questions:
  • ________ is the most theoretical computing discipline, focusing mostly on finding new and better ways for computers to work
    9·1 answer
  • WHAT IS THE MOST POWERFUL PART IN A CAR
    13·2 answers
  • Problem: design the following rectangular floor beam for a building.
    15·2 answers
  • Which of the following statements about pitot-static systems is FALSE? a). A pitot probe measures the Total Pressure of the free
    10·1 answer
  • Before turning in a test, it would be best to
    6·2 answers
  • How many 3-digits numbers which are greater than 300 can be formed from 6
    12·1 answer
  • Explain the function of both of the organelles pictured below.
    14·1 answer
  • 2. What is the most obvious elements of design?<br> O color<br> O shape<br> O line<br> O texture
    11·1 answer
  • What is the density of the mass of 24.0g and a volume of 6 ml?
    13·1 answer
  • All of the following have the same units except: Group of answer choices resistance capacitive reactance. inductance. impedance.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!