Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6740415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:36:12+00:00 2026-05-26T11:36:12+00:00

Add two more constructors that are analogous to the set Time methods described in

  • 0

Add two more constructors that are analogous to the set Time methods described in parts c and d.

Part c: Write a method setTime(hour, minute) that sets time if the given values are valid.

    public void SetTime(int newHour, int newMinute)
        { 
            if (hourIsValid = true)
                  hour = newHour;
            if (minuteIsValid = true)
                 minute = newMinute;
        }

Part d: Write another method setTime(hour,minute,isAm) that sets the time if the given values are valid. The given hour should be in the range of 1 to 12. The parameter isAM is true if the time is an a.m time and false otherwise.

    public void SetTime(int newHour, int newMinute, boolean isAM)
{ 
   if (hour >=0 && hour < 12)
   {        isAM = true;
            hour = newHour;}

   if (minuteIsValid = true)
          minute = newMinute;

   if (isAM = true)
       System.out.println ( hour + "a.m");
   else
       nightHour = hour % 12;
       System.out.println( nightHour + "p.m");

}

That is what i produced so far, what is being asked to be produced by analogous? I know it means similar but w does it mean like for part C just the two separate like SetHour and SetMinute?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:36:12+00:00Added an answer on May 26, 2026 at 11:36 am

    Every class can have multiple constructors, each one can get different variables.

    For this homework, you should add constructors that get the values similar to the setters functions, and use the setters:

        public ClassName(int newHour, int newMinute)
        {
            SeTime(newHour, newMinute);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add two lists of a numeric type such that addedList[x] =
How can one add two long values in Java so that if the result
I wondered about if it's possible to add two or more complete functions to
The problem is this, when I add two or more doubles from a table
I have a set of custom PropertyDescriptor that I want to add categories too
How can i add two or more addresses using contacts contract? I have three
I'm trying to add two folders to my eclipse project's classpath, let's say Folder
I'm trying to add two inputs to a QTCaptureSession in the following: mainSession =
How do I add two numbers without using ++ or + or any other
Can i add two header text in Datagrid? My Requirement is to have two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.