subject

Solve the following questions.
after write a method for each question, you need to write a class 'testnameclass' in a separate file, which includes a main method. in your main method, create two object of class name type and test each method you defined in the name class.

1. create a class called name that represents a person's name. the class should have fields representing the person's first name, last name, and middle initial. (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", 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", returns "public, john q.".

3. write a tostring method for the name class that returns a string such as "john q. public". 4. add a constructor to the name class that accepts a first name, middle initial, and last name as parameters and initializes the name object's state with those values.

5. encapsulate the name class. make its fields private and add appropriate accessor methods to the class.

6. add methods called setfirstname, setmiddleinitial, and setlastname to your name class. give the parameters the same names as your fields, and use the this keyword in your solution.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:30
Nathan wants to create multiple worksheet containing common formatting styles for his team members. which file extension him to save these worksheets? nathan to create multiple worksheets with common styles. he needs to save them with the extension.
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
Jaina and tomas are being considered as new tenants in an apartment. the landlord looks at their creditworthiness because he wants to be sure his new tenant pays the rent on time and in full. the table below summarizes the information that was on their applications. application information questions jaina tomas how many years have you had your job? 5 2 what is your monthly salary? $1,850 $2,500 how many credit cards do you have? 4 1 how much debt do you have? $13,000 $7,000 how many times were you late with payments on credit cards in the past year? 5 1 who will the landlord decide to be more creditworthy and why? tomas because the ratio of his debt to income is less. jaina because she has had her job longer, which makes her look more stable. jaina because she has more credit cards available to her. tomas because he makes more money per month.
Answers: 2
question
Computers and Technology, 23.06.2019 15:30
The processing of data in a computer involves the interplay between its various hardware components.
Answers: 1
question
Computers and Technology, 23.06.2019 20:30
What is the biggest difference between section breaks and regular page breaks
Answers: 1
You know the right answer?
Solve the following questions.
after write a method for each question, you need to write a cl...
Questions
question
History, 06.04.2020 02:19
question
Mathematics, 06.04.2020 02:19
question
Mathematics, 06.04.2020 02:20
Questions on the website: 13722363