Write a computational class to model a toaster. It should have two private instance fields; one to store the number of slots in the toaster and the other to store the desired toast setting (â€œlightâ€, â€œmediumâ€, or â€œdarkâ€). Include a constructor that accepts an integer value between 1 and 6 to set the number of slots. Write public methods to set and get each instance value. The toasting times for â€œlightâ€, â€mediumâ€, or â€œdarkâ€ are 2, 4, 6 minutes respectively. Write a public method, estimatedTime(), that checks the toast setting and returns the time required.
Write an interface class using the constructor, initialize the toaster object to 2 slots. The interface should prompt the user to indicate toasting setting using by entering 1, 2, or 3 for â€œlightâ€, â€œmediumâ€, or â€œdarkâ€. Using the estimatedTime method the interface should then report to the user, â€œYour toast will be done in ~~~ minutesâ€, replacing the ~~~ with the appropriate toasting time.