1、罗布正面对着一个距离他零步或多步远的玩具箱。罗布右手拿着一个玩具。创建一个算法,指导罗布将玩具放入玩具箱。
1. repeat until you are directly in front of the toy chest:
- walk forward
2. drop the toy in the toy chest
2、你刚购买了一套新的个人计算机系统。在组装系统组件之前,你阅读了随系统附带的说明书。说明书中列出了你应收到的组件清单。说明书建议你通过将收到的组件与清单上的组件进行匹配,来验证是否收到了所有组件。如果收到了某个组件,你应该在清单上划掉该组件的名称;否则,你应该在清单上该组件的名称周围画一个圈。创建一个算法,展示你应采取的步骤,以验证包裹中是否包含正确的组件。
- 对清单上的每个组件名称重复以下操作:
- 从清单中读取组件名称;
- 在包裹中搜索该组件;
- 如果收到了该组件,执行以下操作:
- 划掉清单上该组件的名称;
- 否则,执行以下操作:
- 在清单上该组件的名称周围画一个圈。
3、一家商店为年满65岁的顾客提供10%的折扣。编写两个版本的算法,用于打印顾客应付的金额。请确保正确缩进指令。
# 版本一:
read the customer’s age and item price
if the customer’s age is greater than or equal to 65, do this:
assign 10% as the discount rate
calculate the amount due by subtracting the discount rate from the number 1, and then multiplying the result by the item price
print the amount due
if the customer’s age is less than 65, do this:
assign 0 as the discount rate
calculate the amount due by subtracting the discount rate from the number 1, and then multiplying the result by the item price
print the amount due
# 版本二:
read the customer’s age and item price
if the customer’s age is greater than or equal to 65:
assign 10% as the discount rate
else:
assign 0 as the discount rate
calculate the amount due by subtracting the discount rate from the number 1, and then multiplying the result by the item price
print the amount due
4、创建一个制作果冻三明治的算法。
- 准备材料:两片面包、果冻、黄油刀。
- 将两片面包放在干净的案板上。
- 用黄油刀取适量果冻。
- 将果冻均匀涂抹在其中一片面包上。
- 把另一片面包盖在涂抹了果冻的面包上。
- 完成,享用果冻三明治。
5、薪资专员需要计算并打印五名员工的总工资。如果一名员工工作超过40小时,他或她应按超过40小时部分的1.5倍工资计算。请完成该计算总工资的算法。
- 重复5次以下操作:
- 读取员工姓名、工作小时数和工资率
- 如果工作小时数小于等于40,执行以下操作:- 计算总工资 = 工作小时数 × 工资率
- 否则,执行以下操作:
- 计算正常工资 = 工资率 × 40
- 计算加班小时数 = 工作小时数 - 40
- 计算加班工资 = 加班小时数 × 工资率 × 1.5
- 计算总工资 = 正常工资 + 加班工资
- 打印员工姓名和总工资
6、如何修改算法,以便让用户输入奖金率,然后使用该比率来计算奖金金额?
可以按以下步骤修改算法:
- 增加让用户输入奖金率的步骤;
- 去掉根据销售金额判断奖金率的步骤;
- 直接使用用户输入的奖金率来计算奖金。
具体算法如下:
- 输入年度销售额;
- 输入奖金率;
- 通过年度销售额乘以奖金率来计算奖金;
- 显示奖金。
7、在流程图中,______符号用于表示从用户处获取信息的指令。a. 输入 b. 输入/输出 c. 处理 d. 开始/结束
a
8、在对算法进行桌面检查时,你应该设置一个包含 _ _的表格。 a. 每个输入项一列和每个输出项一列 b. 每个输入项一列和每个处理项一列 c. 每个处理项一列和每个输出项一列 d. 每个输入项一列、每个处理项一列和每个输出项一列
D
9、在流程图中,指令“销售税 = 销售额 × 税率”会出现在一个______中。a. 椭圆形 b. 平行四边形 c. 矩形 d. 正方形
C
1101



被折叠的 条评论
为什么被折叠?



