Answer:
import java.util.Scanner;
public class ANot {
public static void main(String[] args) {
Scanner in = new Scanner (System.in);
System.out.println("How many cookies did you eat today");
int numOfCookies = in.nextInt();
double numCalories = (numOfCookies*300)/4;
System.out.println("The total number of calories you consumed in "+numOfCookies+" cookies is " +
" "+numCalories);
}
}
Explanation:
This code is implemented in Java.
- We know from the question that 4 cookies contain 300 calories
- Therefore number of calories consumed = (number of cookies eaten*300)/4
- To implement this in java we used the scanner class to prompt user for the input
- save the input to a variable and write mathematical expression for the number of calories consumed
- Then output the result
<span>University of California, Berkeley _ comp sci
De Anza College, _ comp sci</span>
Answer:
Complete the ZipZapZop()
function so that it requests an integer from the user. The function should display a response following this pattern:
• Divisible by 3: zip
• Divisible by 5 zap
• Divisible by 7 zop
Otherwise, just display the number
Note 1 numbers that are divisible by more than one (3, 5, or 7) should contain
all applicable terms.
Notes 2 Note that you are displaying directly from this function, not returning a value to the calling function.
Hint: The number only prints if it is not divisible by ALL of 3,5,or 7
Explanation:
It should work unless you did or bought the wrong thing