源源的JAVA作业DAY_02

本文介绍了JavaDay02的学习内容,包括使用Scanner获取用户输入并找出最大数字,以及处理数据库查询中员工工资(考虑奖金)的计算。还展示了作业中的代码示例和SQL函数实现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 DAY_02

<br>1,整理当天上课内容到博客

<br>2,使用&nbsp;Scanner&nbsp;结合&nbsp;三元表达式,让用户输入3个数字后,返回用户输入的最大数字

<br>3,数据库:求员工的全部工资(工资+奖金)&nbsp;,如果奖金为空,按1000&nbsp;计算,不为空,在原来的基础上加1000&nbsp;奖金

作业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;

输出结果:

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值