Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i can't find the error public void setsecond(int second) f this. second = second; 1 public String tostring() & 3 public class Main public static

i can't find the error
image text in transcribed
image text in transcribed
public void setsecond(int second) f this. second = second; 1 public String tostring() \& 3 public class Main public static void main(String []args) f Time [] time=\{new Time (), new Time(), new Time ()) ; time [1] . sethour ( houz: 6) : time [0]. setMinute (minute: 20); System. out.println ( r: time [1].getHour ()) ; system. out. println( : time [2], getsecond ()); for (Time t:t ime) t System. out.println (x:t): 3 3 QUESTION 1 Create a class Time and complete the following parts in the class: 1. Define the class attributes (hour. minute, second). 2. Define class constructors to initialize the attributes. 3. Define all setter and getters methods for the attributes. 4. Define toString method to print the time as a single text. In the main method: 1. Create an array time using class Time. 2. Create three objects from Time inside the array. 3. Change the hour's value of time[1] to 6. 4. Change the minute's value of time[0] to 20. 5. Print out the hour's value of time[1]. 6. Print out the second's value of time[2]. 7. Print out all objects in time as strings. Attach File

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

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions

Question

3 > O Actual direct-labour hours Standard direct-labour hours...

Answered: 1 week ago