程序运行网站:
https://www.jyshare.com/compile/10/
课堂任务:
Given the integer 968, extract and print each digit (hundreds, tens, and ones).
课后作业:
Write code: A bookstore is running a promotional discount. The discount is determined by the quantity purchased, and the final payment amount should be calculated as an integer.
Initialize: price(double) = 9.99; quantity(int) = 16
Processing Rules:
Calculate the original total: originalTotal = price × quantity
Determine whether to apply a discount: if quantity ≥ 10, apply a 10% discount (multiply by 0.9)
Type casting: Convert the final amount to int (round to the nearest integer, not truncate)
Output the discounted amount as an integer
完成后请提交至问卷星:https://v.wjx.cn/vm/PptkGpk.aspx#