DAY_02
<br>1,整理当天上课内容到博客
<br>2,使用 Scanner 结合 三元表达式,让用户输入3个数字后,返回用户输入的最大数字
<br>3,数据库:求员工的全部工资(工资+奖金) ,如果奖金为空,按1000 计算,不为空,在原来的基础上加1000 奖金
作业1
源源的学习笔记之JAVA_DAY_02_眰恦46的博客-CSDN博客
作业2
package com.iweb.airui369.day02.operation;
import java.util.Scanner;
public class Day02 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int a,b,c;
System.out.println("请输入三个数字:");
a = scanner.nextInt();
b = scanner.nextInt();
c = scanner.nextInt();
System.out.println("这三个数字中最大数字是:" + ((a>b ? a : b)>c ? (a>b ? a : b) : c));
}
}
输出结果:
作业3
create or replace function calculateAllIncome(eno in emp.empno%type)
return number
is
v_sal emp.sal%type;
v_comm emp.comm%type;
begin
select sal,comm into v_sal,v_comm from emp where empno = eno;
if v_comm is null then
v_comm := 1000;
end if;
return (v_sal + v_comm);
end;
select e.*,calculateAllIncome(e.empno) as 总收入 from emp e;
输出结果: