【Java基础】- 周测

2、【MySQL数据库】- 数据库简单练习题目和答案

在下图这些表中操作

customer 客户表

goods 商品表

orders 订单表

请使用easyshopping数据库,完成以下查询语句的编写:
1.    查询orders表中所有订单日期(ordersDate)大于2015-1--1的订单。
select ordersDate from orders where ordersDate>2015-1-1;
2.    查询orders表中数量(amount)不为空的数据。
select amount from orders where amount is not  Null;
3.    查询goods表中价格(unitPrice)位于100-300之间的商品数据,并按工资降序排列。
select unitPrice from goods where unitPrice  BETWEEN 100 and 300 order by unitPrice desc;
4.    查询customer表中刘一鸣的信息。
select * from customer where cName like '刘一鸣';
5.    查询customer表中地址为“北京”、“上海”的顾客信息。
select * from customer where city in('北京','上海');


 

1、【Java基础】-Java基础练习题目与答案(数组的应用)

题目

学校Java课程对同学进行抽检评测,评测分为两个部分:理论部分以及机试部分,最终评测成绩=理论成绩×0.3+机试成绩×0.7,要求输入5位学生的理论成绩和实操成绩,计算并输出各位学生的最终评测成绩。

运行效果

答案:

package cn.com.mstanford.lotterysystem;

import java.util.Scanner;

public class ExamDemo {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 定义数组存储学生理论成绩
		int[] writenExam = new int[5];
		// 定义数组存储学生机试成绩
		int[] labExam = new int[5];
		// 定义数组存储学生最终评测成绩
		double[] scores = new double[5];
		// 接收用户输入的理论成绩和机试成绩
		for (int i = 0; i < writenExam.length; i++) {
			System.out.printf(" 第 %d 位学生评测分数:\n", i + 1);
			System.out.print(" 理论成绩:");
			writenExam[i] = sc.nextInt();
			System.out.print(" 机试成绩:");
			labExam[i] = sc.nextInt();
		}
		// 计算学生最终评测成绩
		for (int i = 0; i < scores.length; i++) {
			scores[i] = writenExam[i] * 0.3 + labExam[i] * 0.7;
		}
		// 显示最终评测得分
		System.out.println(" 最终评测成绩:");
		for (double item : scores) {
			System.out.printf("%.2f\n",item);
		}
	}
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

a box of Sweets

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值