Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Default Object Methods You have not previously encountered to toString method. This takes whatever object that you have created and tries to convert it

image text in transcribed
Using Default Object Methods You have not previously encountered to toString method. This takes whatever object that you have created and tries to convert it to a string The reasons for this will be discussed in week 6 Try it out with your persont object. Use the code System.out println (personl.toString33 You should see something ike person. Person 15db9742 Why? Because your Person object doesn't handle toString) correctly. Try to fix this. Try to create a toStringl) method that receives no parameters and returns a String Your output should look lke HINT get a newline in a String by using n Created Autumn 2017, Moddied Autumn 2018 By Dr Andrew Abel CSE 105-Introduction to Java Programming Department of Computer Science and Software Engineering Person Arrays You worked with arrays last week, but an array can be of amy type. For example you can create an array of Person objects Create an array of S Person objects, and then use a For loop to view the toString method of each person. Ask if you don't understand . Give them all a birthday in the for loop! e in week 4, you discussed how to search arrays for useful information. We want to find the person than has the lowest id number. There are several steps involved in this. Firstly, you need to create a method in your Person class that will return an integer, and return that object's id value Call it getio - Then, using an array of objects, and your getiDO method, create a method in your LabS class that w earch through the array, and identity the lowest student number See some hints below! Output Lab5 (run) Fersn called Ting createdhID 123 Person called Joe created vith ID: 102 Person called Andrew created with ID: Pezson called Conor created vith ID: 993 Pezson called Yoexasn created with ID: 702 The Lovest ID anber 18 202 The ID belongs to Joe UILD SUCCESSEUL (total tine: O seconds)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

Use good transitions

Answered: 1 week ago

Question

Know how productivity improvements impact quality and value.

Answered: 1 week ago

Question

Recommend the key methods to improve service productivity.

Answered: 1 week ago