Log In

Need Help With A Java Program

Write acomputational class to model a toaster. It should have two privateinstance fields; one to store the number of slots in the toaster andthe other to store the desired toast setting (“light”, “medium”,or “dark”). Include a constructor that accepts an integer valuebetween 1 and 6 to set the number of slots. Write public methods toset and get each instance value. The toasting times for “light”,”medium”, or “dark” are 2, 4, 6 minutes respectively. Write apublic method, estimatedTime(), that checks the toast setting andreturns the time required.

Write an interfaceclass using the constructor,initialize the toaster object to 2 slots. The interface should promptthe user to indicate toasting setting using by entering 1, 2, or 3for “light”, “medium”, or “dark”. Using the estimatedTimemethod the interface should then report to the user, “Your toastwill be done in ~~~ minutes”, replacing the ~~~ with theappropriate toasting time.

Please help.

× How can I help?