java学院代码,毕业学院代码-成都快上网建站

java学院代码,毕业学院代码

用JAVA编写一个处理学院员工月薪的应用程序的代码是什么?

abstract class Person{

成都创新互联专注于中大型企业的成都网站设计、网站制作和网站改版、网站营销服务,追求商业策划与数据分析、创意艺术与技术开发的融合,累计客户近千家,服务满意度达97%。帮助广大客户顺利对接上互联网浪潮,准确优选出符合自己需要的互联网运用,我们将一直专注成都品牌网站建设和互联网程序开发,在前进的路上,与客户一起成长!

private String name;

private String post;

Person(String name,String post){

this.name = name;

this.post = post;

}

public String getID(){

return (name+""+post);

}

public abstract double counting();

public void setName(String name){

this.name = name;

}

public String getName(){

return this.name;

}

public void setPost(String post){

this.post = post;

}

public String getPost(){

return this.post;

}

}

class Leader extends Person{

Leader(String name,String post){

super(name,post);

}

public double counting(){

return 3000d;

}

}

class Management extends Person{

private double basicWage=0d; //基本工资

private double allowance=0d; //津贴

Management(String name,String post){

super(name,post);

}

public void setBasicWage(double basicWage){

this.basicWage = basicWage;

}

public double getBasicWage(){

return this.basicWage;

}

public void setAllowance(double allowance){

this.allowance = allowance;

}

public double getAllowance(){

return this.allowance;

}

public double counting(){

return this.basicWage+this.allowance;

}

}

class Teacher extends Person{

private int hours; //课时

static final double ASSISTANT_STANDARD = 35.0d;//助教的课时收费标准

static final double LECTOR_STANDARD = 45.0d;//讲师的课时收费标准

static final double ANOTHER_STANDARD = 55.0d;//其他课时收费标准

Teacher (String name,String post){

super(name,post);

}

public double counting(){

double wage; //工资

if(this.getPost().equals("助教")){

wage = ASSISTANT_STANDARD*hours;

}else if(this.getPost().equals("讲师")){

wage = LECTOR_STANDARD * hours;

}else{

wage = ANOTHER_STANDARD * hours;

}

return wage;

}

public void setHours(int hours){

this.hours = hours;

}

public int getHours(){

return this.hours;

}

}

class Test {

public static void main(String [] args){

Leader leader = new Leader("张三","领导");

System.out.println(leader.getName()+"工资为:"+leader.counting());

Management manage = new Management("李四","管理人员");

manage.setBasicWage(1000d);

manage.setAllowance(500d);

System.out.println(manage.getName()+"工资为:"+manage.counting());

Teacher teacher = new Teacher("王五","助教");

teacher.setHours(50);

System.out.println(teacher.getName()+"工资为:"+teacher.counting());

Teacher teacher1 = new Teacher("赵六","讲师");

teacher1.setHours(60);

System.out.println(teacher1.getName()+"工资为:"+teacher1.counting

());

}

}

看下吧,有什么不足的请指出来

Java编程,填写下面的代码

class NoLowerLetterException extends Exception {

public NoLowerLetterException(String msg) {

super(msg);

}

}

class NoDigitException extends Exception {

public NoDigitException(String msg) {

super(msg);

}

}

class People {

void printLetter(char c) {

if (c = 'a' c = 'z') {

System.out.println(c);

} else {

try {

throw new NoLowerLetterException(String.valueOf(c));

} catch (NoLowerLetterException e) {

e.printStackTrace();

}

}

}

void printDigit(char c) {

if (c = '0' c = '9') {

System.out.println(c);

} else {

try {

throw new NoDigitException(String.valueOf(c));

} catch (NoDigitException e) {

e.printStackTrace();

}

}

}

}

public class ExceptionExample {

public static void main(String args[]) {

People people = new People();

for (int i = 0; i 128; i++) {

// 【代码5】

// //将i转换为char类型,执行people.printLetter()方法,如果出现异常则捕获,并输出异常的错误信息!

people.printLetter((char) i);

}

for (int i = 0; i 128; i++) {

// 【代码6】 //将i转换为char类型,执行people. printDigit

// ()方法,如果出现异常则捕获,并输出异常的错误信息!

people.printDigit((char) i);

}

}

}

我想看一点简单的Java程序的源代码

兄弟可以联系 hi留言也行

我这里保留了,从学习java第一天起到现在 学习练习代码,

基础部分注释很详细。

//每一位相加求和

public class Demo

{

public static void main(String[] args)

{

int i = 45678;

int sum = 0;

int c = 0;

for(int j = 4; j = 0; j--)

{

int b = (int) Math.pow(10, j);

c = i / b;

System.out.println(c);

sum += c;

System.out.println("sum=" + sum);

i %= b;

}

System.out.println(sum);

}

}

public class ZY1030

{

public static void main(String[] asgs)

{

zy1();

zy2();

zy3();

zy4();

zy5();

zy6();

zy7();

yanghuisanjiao();

}

public static void yanghuisanjiao()

{

int[][] pas = new int[6][];

for(int i = 0; i pas.length; i++)

{

pas[i] = new int[i + 1];

pas[i][0] = 1;

pas[i][i] = 1;

for(int j = 0; j pas[i].length - 1; j++)

{

if(j = 1 i 1)

pas[i][j] = pas[i - 1][j - 1] + pas[i - 1][j];

}

}

for(int i = 0; i pas.length; i++)

{

for(int j = 0; j pas[i].length; j++)

{

System.out.print(pas[i][j]);

System.out.println();

}

}

System.out.println();

}

private static void zy1()

{

System.out.println("��ҵ1");

/*

*

**

***

****

*****

******

*******

*/

for(int r = 0; r 7; r++)

{

for(int j = 0; j r + 1; j++)

{

System.out.print("*");

}

System.out.println();

}

}

private static void zy2()

{

System.out.println("\n��ҵ2");

/*

*

***

*****

*******

*********

*/

for(int r = 0; r = 5; r++)

{

for(int j = 0; j 11 - r; j++)

{

System.out.print(" ");

}

for(int j = 0; j r * 2 + 1; j++)

{

System.out.print("*");

}

System.out.println();

}

}

private static void zy3()

{

System.out.println("\n��ҵ3");

/*

*

* *

* * *

* * * *

* * * * *

*/

for(int r = 0; r = 5; r++)

{

for(int j = 0; j 10 - r; j++)

{

System.out.print(" ");

}

for(int j = 0; j r; j++)

{

System.out.print("* ");

}

System.out.println();

}

}

private static void zy4()

{

System.out.println("\n��ҵ4");

/*

***********

***********

***********

***********

***********

*/

for(int r = 0; r = 5; r++)

{

for(int j = 0; j 7 - r; j++)

{

System.out.print(" ");

}

for(int j = 0; j 10; j++)

{

System.out.print("*");

}

System.out.println();

}

}

private static void zy5()

{

System.out.println("\n��ҵ5");

/*

1X1=1

1X2=2 2X2=4

1X3=3 2X3=6 3X3=9

....

*/

for(int r = 1; r = 9; r++)

{

for(int j = 1; j = r; j++)

{

int iValue = j * r; //����ֵ

String str = j + "X" + r + "=" + iValue + " ";

System.out.print(str);

//System.out.print(" J:" + j);

}

System.out.println();

//System.out.println("R:" + r);

}

}

private static void zy6()

{

System.out.println("\n��ҵ6");

/*

������(����) ֻ�ܱ�1�ͱ����������������

3 5 7 11 13 17 19 23 ....

int n = 4;

boolean t = true; // assume is SU_SHU

for(int i=2; in; i++)

{

if(n%i==0)

{

t = false;

break;

}

}

System.out.println(t);

*/

for(int i = 2; i = 100; i++)

{

// if(i % 2 ==0 || i % 3 == 0 )

// {

// continue;

// }

// System.out.print(i + " ");

boolean bTrue = true;

for(int j = 2; j i; j++)

{

if(i % j == 0)

{

bTrue = false;

break;

}

}

if(bTrue)

{

System.out.println(i);

}

}

System.out.println();

}

private static void zy7()

{

System.out.println("\n��ҵ7");

/*

int n = 23623;

int x = n % 100000 / 10000;

System.out.println(x);

x = n % 10000 / 1000;

System.out.println(x);

x = n % 1000 / 100;

System.out.println(x);

*/

}

}

Java实验,代码怎么写?

Shape.java接口代码

public interface Shape {

public static final double PI = 3.14d;

public double area();

}

Circle.java圆类代码

public class Circle implements Shape {

private double radius;

public Circle(double radius) {

  this.radius = radius;

}

@Override

public double area() {

  return PI * this.radius * this.radius;

}

public double perimeter() {

  return 2 * PI * this.radius;

}

}

Cylinder.java圆柱体类代码

public class Cylinder extends Circle {

private double height;

public Cylinder(double radius, double height) {

  super(radius);

  this.height = height;

}

public double area() {

  return 2 * super.area() + super.perimeter() * this.height;

}

public double volume() {

  return super.area() * this.height;

}

}

X5_3_6.java主类代码

public class X5_3_6 {

public static void main(String[] args) {

  Circle cir1 = new Circle(5);

  System.out.println("圆的面积为:" + cir1.area());

  System.out.println("圆的周长为:" + cir1.perimeter());

  Cylinder cy1 = new Cylinder(10, 15);

  System.out.println("圆柱体的表面积为:" + cy1.area());

  System.out.println("圆柱体的体积为:" + cy1.volume());

}

}

上面是我写的代码,下图是执行结果,麻烦看一下,是否可以。

java线程的经典代码

package threadgroup;

class ThreadDemo3 extends Thread {

private String name;

private int delay;

public ThreadDemo3(String sname, int i_delay) {

name = sname;

delay = i_delay;

}

public void run() {

try {

sleep(delay);

} catch (InterruptedException e) {

}

System.out.println("多线程测试!\n" + name + "\n" + delay);

}

}

public class testMyThread {

public static void main(String[] args) {

ThreadDemo3 th1,th2,th3;

th1 = new ThreadDemo3("线程1", (int) (Math.random() * 900));

th2 = new ThreadDemo3("线程2", (int) (Math.random() * 900));

th3 = new ThreadDemo3("线程3", (int) (Math.random() * 900));

th1.start();

th2.start();

th3.start();

}

}

package threadgroup;

public class threadDemo {

public static void main(String[] args) {

Thread t = Thread.currentThread();

t.setName("你好吗?");

System.out.println("正在进行的Thread是:" + t);

try {

for (int i = 0; i 5; i++) {

System.out.println("我不叫穆继超" + i);

Thread.sleep(3000);

}

} catch (Exception e) {

// TODO: handle exception

System.out.println("Thread has wrong" + e.getMessage());

}

}

}

package threadgroup;

public class threadDemo2 implements Runnable {

public threadDemo2() {

Thread t1 = Thread.currentThread();

t1.setName("第一个主进程");

System.out.println("正在运行" + t1);

Thread t2 = new Thread(this, "");

System.out.println("在创建一个进程");

t2.start();

try {

System.out.println("使他进入第一个睡眠状态");

Thread.sleep(2000);

} catch (InterruptedException e) {

System.out.println("Thread has wrong" + e.getMessage());

}

System.out.println("退出第一个进程");

}

public void run() {

try {

for (int i = 0; i 5; i++) {

System.out.println("进程" + i);

Thread.sleep(3000);

}

} catch (InterruptedException e) {

// TODO: handle exception

System.out.println("Thread has wrong" + e.getMessage());

}

System.out.println("退出第二个进程");

}

public static void main(String[] args) {

new threadDemo2();

}

}


新闻标题:java学院代码,毕业学院代码
链接地址:http://kswjz.com/article/dssgopd.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流