⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 array02.java

📁 已经编写好的数据结构课本程序可以减轻您的负担
💻 JAVA
字号:
// =============== Program Description ===============
// 程序名称: array02.java
// 程序目的: 运用一维数组设计一个简易的员工薪资
//	       管理系统(具查询和修改功能)。
// Written By Kuo-Yu Huang. (WANT Studio.) 
// ===================================================
import ConsoleReader.*;					// 引入已定义的数据输入类别

public class array02
{
							// 预设10笔员工薪资数据
	public static int[] Employee = 
		{ 27000, 32000,  32500,  27500,  28500,
		  29000,  31000,  32500, 30000,  26000 };
	public static int Index;			// 数组索引变量
	public static int NewSalary;			// 修改后薪资变量
	public static int Selection;			// 用户选项变量	
			
	public static void main (String args[])
	{
		boolean	Flag = false;

		while ( !Flag )				// while循环结构
		{
							// 用户菜单
			System.out.println("============================================");
			System.out.println("= Simple Employee Salary Management System =");
			System.out.println("= 1.Display employee salary                =");
			System.out.println("= 2.Modify employee salary                 =");
			System.out.println("= 3.Quit                                   =");
			System.out.println("============================================");
			System.out.print("Please input your choose:");
							// 读取用户输入选项
			ConsoleReader console = new ConsoleReader(System.in);
			int Selection = console.readInt();		
			
			if (Selection == 1 || Selection == 2)
			{
				System.out.print("** Please input the employee number:");
							// 读取员工编号
				Index = console.readInt();

				if (Index < 10)         // 判断员工编号的范围
				{
					System.out.println("** Employee Number is "+Index);
					System.out.println("**The Salary is "+Employee[Index]);
				}
				else
				{
					System.out.println("## The error employee number!!");
					Flag = true;
				}
			}

			switch (Selection)
			{
				case 1:
					break;
				case 2:
					System.out.print("** Please enter new salary:");
							// 读取修改后员工的薪资
					NewSalary = console.readInt();
					System.out.println("");
					Employee[Index] = NewSalary;
					break;
				case 3:
					Flag = true;
					break;
			}
			System.out.println("");
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -