One box of cookies contains 24 cookies one container can hold 75 boxes of cookies. WAP in java to input total number of cookies and find out number of box and containers used
Pls answer by step by step explanation. It's a humble request.
Share
One box of cookies contains 24 cookies one container can hold 75 boxes of cookies. WAP in java to input total number of cookies and find out number of box and containers used
Pls answer by step by step explanation. It's a humble request.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Answer:
import java.util.Scanner;
public class KboatCookies
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter total no. of cookies: ");
int cookieCount = in.nextInt();
System.out.print("Enter no. of cookies per box: ");
int cookiePerBox = in.nextInt();
System.out.print("Enter no. of boxes per container: ");
int boxPerContainer = in.nextInt();
int numBox = cookieCount / cookiePerBox;
if (cookieCount % cookiePerBox != 0)
numBox++;
int numContainer = numBox / boxPerContainer;
if (cookieCount % cookiePerBox != 0)
numContainer++;
System.out.println("No. of boxes = " + numBox);
System.out.println("No. of containers = " + numContainer);
}plz mark me brainliest and follow me
Answer:
your answer is in the attachment