Menu

Create an program that has a method called dividedBy7. This method will take an int parameter named however you would like. This method needs to divide that parameter by 7

Create an program that has a method called dividedBy7. This method will take an int parameter named however you would like. This method needs to divide that parameter by 7 and return it. This method should not have a System.out.println() method in it.
In your main method, you need to set up a Scanner so we can get user input. You will then ask the user to enter a number and store this into an int called number.
You will also need to have a while loop that runs until the number that user has entered has been divided to be at or below 7. Each time that the loop is ran, you need to print out the current value of the int

Expert Answer

This solution was written by a subject matter expert. It’s designed to help students like you learn core concepts.

Step 1/3
import java.util.Scanner;
public class Calculation {
// The method dividedBy7
public double dividedBy7(int input) {
return (double) input / 7;
}
public static void main(String[] args) {
Calculation calculation = new Calculation();
// set up a Scanner so we can get user input.
Scanner scnr = new Scanner(System.in);
// ask the user to enter a number and store this into an int called number.
System.out.print(“Enter a number: “);
int number = scnr.nextInt();
// while loop that runs until the number that user has entered has been divided
// to be at or below 7
while (number > 7) {
// print out the current value of the int and result of dividedBy7
System.out.println(“Number is ” + number + “, Result of dividedBy7 is ” + calculation.dividedBy7(number));
System.out.print(“Enter a number: “);
number = scnr.nextInt();
}
}
}
This question contain pocture

OR