Answer:
Explanation:
The following code is written in Java. I recreated the entire Child class as described with the instance variables and the doubleWeight method. Then created the getter and setter methods for both the weight and height variables.
class Child {
double weight, height;
public double doubleWeight() {
double superWeight = weight * height;
return superWeight;
}
public double getWeight() {
return weight;
}
public void setWeight(double weight) {
this.weight = weight;
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
this.height = height;
}
}
Answer:
scheduling
Explanation:
Scheduling- it is referred to as assigning a task to complete the goal or work on time. he works can include data flow, processing of data, etc.
There are two main types of scheduling
1) Preemptive process
2) Non- preemptive process
Preemptive process - in this process, priority is given to important tasks rather than less important tasks. the current task can be held for an important task
Non-preemptive process - It is referred to that process when the predefined schedule follows. In this process, next task executed only when current task finish
Answer:
if (pH<7.0){
neutral=0;
base=0;
acid=1;
}
else if (pH>7.0){
neutral=0;
base=1;
acid=0;
}
else if (pH==7.0){
neutral=1;
base=0;
acid=0;
}
Explanation:
As required by the question, if and else statements have been used to test the value of the pH and assign the apropriate values to the variables neutral, base and acid.
The code snippet below can be used to prompt the user to enter values for pH
<em>import java.util.Scanner;</em>
<em>public class pHTest {</em>
<em> public static void main(String[] args) {</em>
<em> Scanner scr = new Scanner(System.in);</em>
<em> System.out.println("Enter a value for the pH");</em>
<em> int neutral, base, acid;</em>
<em> double pH = scr.nextDouble();</em>
<em> if (pH<7.0){</em>
<em> neutral=0;</em>
<em> base=0;</em>
<em> acid=1;</em>
<em> }</em>
<em> else if (pH>7.0){</em>
<em> neutral=0;</em>
<em> base=1;</em>
<em> acid=0;</em>
<em> }</em>
<em> else if (pH==7.0){</em>
<em> neutral=1;</em>
<em> base=0;</em>
<em> acid=0;</em>
<em> }</em>
<em>} }</em>
Answer:
4 5 6
Explanation:
Since there is a do-while loop, you need to check the values for each iteration until the condition (Count <= X) is not satisfied.
First iteration -> Count = 1 and X = 3, Y = 1 + 3, Write Y -> 4
Second iteration -> Count = 2 and X = 3, Y = 2 + 3, Write Y -> 5
Third iteration -> Count = 3 and X = 3, Y = 3 + 3, Write Y -> 6
After the third iteration count is equal to 4 and X is equal to 3. That is why loop ends.
The question is asking us to swap the values of xp and yp while not changing where they point to. Setting xp equal to yp would not work because then we couldn't change yp since the value for xp was overwritten. We can use a third variable to swap them.
int zp = xp;
xp = yp;
yp= zp;