问题描述
我正在努力完成我的学校项目,但我陷入了最后一个过程。我需要打印总价格和盒子的数量以及每个的价格。用户需要输入他想要的咖啡袋数量,每袋需要1000个,并且有3个盒子可以装入,一个大盒子装20个袋子,中盒子装10个袋子,一个小盒子装5袋咖啡。每箱的成本分别为5000,3000和1000。我知道我需要使用MOD来确定每个盒子里会有多少,但说实话我甚至不知道从哪里开始!救命?这就是我到目前为止所做的:
我尝试了什么:
案例D:
案例d:
double bolsas = 0;
double Cg = 5000;
double Cm = 3000;
double Cp = 1000;
double precioxB = 1000;
double precioBolsas = 0;
System.out.println(Cuantas bolsas desea ordenar?);
bolsas = sc.nextInt();
precioBolsas = bolsas * precioxB;
I am trying to finish my school project but I am stuck in the last process. I need to print the total price and the amount of boxes and the price of each. The user needs to input how many bags of coffee he wants, each bag costs 1000, and there are 3 boxes to pack them in, a large box fits 20 bags, medium box fits 10 bags and a small box fits 5 bags of coffee. Each box costs 5000,3000 and 1000 respectively. I know I need to use MOD to determine how many will go in each box but to be honest I dont even know where to start! Help? This is what I've done so far:
What I have tried:
case "D":
case "d":
double bolsas=0;
double Cg=5000;
double Cm=3000;
double Cp=1000;
double precioxB=1000;
double precioBolsas=0;
System.out.println("Cuantas bolsas desea ordenar?");
bolsas=sc.nextInt();
precioBolsas=bolsas*precioxB;
推荐答案
这篇关于如何使用MOD计算一个盒子中适合的物品数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!