Answer:
Answered below
Explanation:
# Program is written in Java
class WeekHours{
double school;
double fun;
double sleep;
double sports;
WeekHours( ){
school = 0.0;
fun = 0.0;
sleep = 0.0;
sports = 0.0;
}
public void setSchool ( double x){
school = x;
}
public void setFun( double y){
fun = y;
}
public void setSleep( double w){
sleep = w;
}
public void setSports( double z){
sports = z;
}
public void totalHours(){
double tHours = school + fun + sleep + sports;
System.out.print(tHours);
}
}
Answer:
look at the attachment for correct answers.
Answer:
Explanation:
The following code was written in Java and performs the exact requirements listed in the question. It has also been tested by the runner code and works perfectly.
public static boolean insert(String[] words, String newWord, int place) {
if (place > words.length) {
return false;
} else {
for (int x = words.length - 1; x >= 0; x--) {
if (place == x) {
words[x] = newWord;
break;
} else {
words[x] = words[x-1];
}
}
return true;
}
}