I am having a hard time with questions 6a and 6b. 6a. I have to write a class that declares a variable named minutes, which holds minutes worked on a job, and assign a value. Display the value in hours and minutes; for example, 197 minutes becomes 3 hours and 17 minutes. Be sure to use a named consant where appropriate. 6b. Write an interactive version of the Time class that accepts the minutes worked from a user. How do I do these questions? I am very confused on how to do them. Needed basic code help.
1
Expert's answer
2010-05-17T04:12:25-0400
You may use this code, it will help you to solve your Java task. class Time { private int minutes;//holds minutes
public void setMinutes(int min){//assign a value this.minutes = min; }
public String toString()// returns string the value in hours and minutes { int hours = (int) minutes/60; int mins = minutes - hours*60; return hours+" hours and "+mins+" minutes"; } }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment