Need help with a Java program.

Feb 3rd, 2015
Anonymous
Category:
Programming
Price: $5 USD

Question description

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.


Please help.


Tutor Answer

(Top Tutor) Gourishankar P
School: University of Virginia

Studypool has helped 1,244,100 students

Review from student
Anonymous
" Excellent job "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1825 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors