类与对象java课程设计
⑴ java课程设计
去网站上下载一个,这里没人能给你写这么多
⑵ java课程设计
根据网上的资料,自己改吧改吧就好专了。属
http://wenku..com/link?url=d6T6qVFsQ9I4HSpdbTK0WjDBQV0_BGU5sJCVeMl3kQ_-Cy3_mowAB9e8T6t0VRY_xwFtIRhzu
⑶ 运用Java的类和对象设计一个学生类,包括学生的学号,性别,专业,课程,课程成绩,能够统计学生上课
学生类:学号,性别,专业
课程类:名称等等
学生课程对应类:学生主键,课程主键
每学期各科成绩类:学生主键,课程主键,学期(时间)
考勤类:学生主键,日期(时间)
大致思路就这样,感觉不是很难,省下靠你自己补全
⑷ 求java课程设计(学生个人信息管理系统)
邮箱中查收,本人的程序绝对好,原创保证只有你一个人才有!
⑸ 《Java程序设计一》 1,设计课程类及类中包含的属性和方法.
/**
*第一题
*
*@author我为足球狂
*/
importjava.util.Random;
importjava.text.DecimalFormat;
/**
*课程类课程编号设定为7位随机任意字符串编码
*/
classKeCheng{
publicStringKeChengID;
publicStringKeChengName;
/**
*以下为私有变量及其公开方法
*/
privatedoubleFenShu;//分数应设置为私有,保证安全
publicvoidsetFenShu(doublefenshu){
this.FenShu=fenshu;
}
publicdoublegetFenShu(){
returnthis.FenShu;
}
/**
*辅助指定输出格式
*/
publicvoidprint(){
if(this.getFenShu()<10){
DecimalFormatdf=newDecimalFormat("#0.00");
System.out.println("|编号:"+this.KeChengID+"|课名:"
+this.KeChengName+"|分数:"+df.format(this.getFenShu())
+"| ");
}else{
DecimalFormatdf=newDecimalFormat("#00.00");
System.out.println("|编号:"+this.KeChengID+"|课名:"
+this.KeChengName+"|分数:"+df.format(this.getFenShu())
+"| ");
}
}
/**
*以下为构造方法
*/
KeCheng(){
StringkcID=(newGenerateSuiJiBianHao()).randomString(7);//此处7指课程编号长度,可自由修改
this.KeChengID=kcID;
this.KeChengName="未指定";
this.setFenShu(-99.99);
print();
}
KeCheng(StringkechengName,doublefenshu){
StringkcID=(newGenerateSuiJiBianHao()).randomString(7);
this.KeChengID=kcID;
this.KeChengName=kechengName;
this.setFenShu(fenshu);
print();
}
}
/**
*以下产生随机课程编号的类
*/
classGenerateSuiJiBianHao{
privatestaticRandomrandGen=null;
privatestaticchar[]numbersAndLetters=null;
(intlength){
if(length<1){
returnnull;
}
if(randGen==null){
randGen=newRandom();
numbersAndLetters=(""
+"").toCharArray();
}
char[]randBuffer=newchar[length];
for(inti=0;i<randBuffer.length;i++){
randBuffer[i]=numbersAndLetters[randGen.nextInt(71)];
}
returnnewString(randBuffer);
}
}
/**
*以下为主类
*/
publicclassCourse{
publicstaticvoidmain(String[]args){
//演示示例
System.out.print(" ");
System.out.println("—————————————————————————————————————— ");
KeChengkc1=newKeCheng();
KeChengkc2=newKeCheng("自然地理学",99.5);
//10个随机指定课程名(四位字符串)和分数的示例
System.out.println("—————————随机指定课程名(四位字符串)和分数示例—————————— ");
for(inti=1;i<10;i++){
KeChengkcGroup=newKeCheng(
(newGenerateSuiJiBianHao()).randomString(4),
(newRandom().nextDouble())*100);
}
}
}/*
等我下午踢完球晚上回来继续答
*/
⑹ Java课程设计问题
邮件已发送,请查收。
1.:
public class Matrix {
int i[][];
Matrix(){//构造一个10X10个元素的矩阵,没有数据
i=new int[10][10];
}
Matrix(int n,int m){//构造一个n*m个元素的矩阵,数据由随机数产生
i=new int[n][m];
for(int j=0;j<=n-1;j++){
for(int k=0;k<=m-1;k++)
i[j][k]=(int) (Math.random()*10);
}
}
Matrix(int table[][]){//以一个整型的二维数组构造一个矩阵
i=table;
}
public void output(){//输出Matrix类中数组的元素值
for(int j=0;j<=i.length-1;j++){
for(int k=0;k<=i[0].length-1;k++)
System.out.print(i[j][k]+" ");
System.out.println();
}
}
public void transpose(){//输出一个矩阵的转置矩阵
for(int j=0;j<=i[0].length-1;j++){
for(int k=0;k<=i.length-1;k++)
System.out.print(i[k][j]+" ");
System.out.println();
}
}
public static void main(String args[]){
Matrix m=new Matrix(4,5);
m.output();
System.out.println();
m.transpose();
Square s=new Square(5);
s.output();
System.out.println();
s.transpose();
}
}
public class Square extends Matrix{
Square(){
i=new int[10][10];
}
Square(int b){
super(b,b);
}
Square(int table[][]){
if(table.length==table[0].length)
i=table;
}
}
2:
public class Complex {
int x,y;
Complex(){}
Complex(int i,int j){
x=i;
y=j;
}
public void showComp(){
if(y>=0)
System.out.println(x+"+"+y+"i");
else
System.out.println(x+""+y+"i");
}
public Complex addComp(Complex C1,Complex C2){
return new Complex(C1.x+C2.x,C1.y+C2.y);
}
public Complex subComp(Complex C1,Complex C2){
return new Complex(C1.x-C2.x,C1.y-C2.y);
}
public Complex multiComp(Complex C1,Complex C2){
return new Complex(C1.x*C2.x-C1.y*C2.y,C1.x*C2.y+C2.x*C1.y);
}
public boolean equalComp(Complex C1,Complex C2){
return C1.x==C2.x&&C1.y==C2.y;
}
public static void main(String args[]){
Complex c=new Complex(1,2);
c.showComp();
c.addComp(new Complex(-1,3), new Complex(3,-3)).showComp();
c.subComp(new Complex(-1,3), new Complex(3,-3)).showComp();
c.multiComp(new Complex(-1,3), new Complex(3,-3)).showComp();
System.out.println(c.equalComp(new Complex(-1,3), new Complex(3,-3)));
System.out.println(c.equalComp(new Complex(3,-3), new Complex(3,-3)));
}
}
3.:
import java.awt.BorderLayout;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class LayoutManager {
public static void main(String args[]){
JFrame jf=new JFrame();
JButton jbA=new JButton("Hello,");
JButton jbB=new JButton("取消");
JButton jbC=new JButton("确定");
JButton jbD=new JButton("Java!......");
JButton jb0=new JButton("0");
JButton jb1=new JButton("1");
JButton jb2=new JButton("2");
JButton jb3=new JButton("3");
JButton jb4=new JButton("4");
JButton jb5=new JButton("5");
JButton jb6=new JButton("6");
JButton jb7=new JButton("7");
JButton jb8=new JButton("8");
JPanel jp=new JPanel();
jp.setLayout(new GridLayout(0,3));
jp.add(jb0);
jp.add(jb1);
jp.add(jb2);
jp.add(jb3);
jp.add(jb4);
jp.add(jb5);
jp.add(jb6);
jp.add(jb7);
jp.add(jb8);
jf.add(jbA,BorderLayout.NORTH);
jf.add(jbB,BorderLayout.WEST);
jf.add(jbC,BorderLayout.EAST);
jf.add(jbD,BorderLayout.SOUTH);
jf.add(jp,BorderLayout.CENTER);
jf.setTitle("布局管理器");
jf.setSize(300, 300);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.setVisible(true);
}
}
⑺ java课程设计源代码(急!!!!)
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import javax.swing.border.LineBorder;
public class game21 extends JFrame {
private JLabel label_2;
private int number;
private int sum;
final JLabel label = new JLabel();
final JLabel label_1 = new JLabel();
public static void main(String[] args) {
new game21();
}
public game21() {
super("21点?!");
getContentPane().setLayout(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JButton button = new JButton();
button.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent arg0) {
onClick();
}
});
button.setText("出牌");
button.setBounds(170, 350, 106, 28);
getContentPane().add(button);
label.setBorder(new LineBorder(Color.black, 1, false));
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setFont(new Font("", Font.BOLD, 26));
label.setText("背面");
label.setBounds(158, 81, 137, 153);
getContentPane().add(label);
label_1.setText("你已经拥有的牌:");
label_1.setBounds(109, 22, 270, 45);
getContentPane().add(label_1);
this.setBounds(200, 300, 501, 528);
this.setVisible(true);
getContentPane().add(getLabel_2());
}
public int randNumber() {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
return (int) (Math.random() * 10 + 1);
}
public void onClick() {
number = this.randNumber();
this.sum += number;
label.setText("" + number);
String strTemp = this.label_1.getText();
strTemp += "" + number + " ";
label_1.setText(strTemp);
String temp = "合计:" + sum;
label_2.setText(temp);
isWin();
}
public void isWin() {
if (sum > 21) {
JOptionPane.showMessageDialog(this, "你输了");
clear();
return;
} else if (sum == 21) {
JOptionPane.showMessageDialog(this, "你赢了");
clear();
return;
} else {
int i = JOptionPane.showOptionDialog(this, "是否继续?", "提示",
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, null, null, null);
if (i == JOptionPane.OK_OPTION) {
onClick();
} else
return;
}
}
private void clear() {
label_2.setText("合计:");
sum = 0;
number = 0;
label_1.setText("你已经拥有的牌:");
}
/**
* @return
*/
protected JLabel getLabel_2() {
if (label_2 == null) {
label_2 = new JLabel();
label_2.setText("合计:");
label_2.setBounds(313, 35, 66, 18);
}
return label_2;
}
}
真好无聊中。。
⑻ JAVA课程设计题目
public class Calculator
{
private double oper1;
private double oper2;
public Calculator(double oper1,double oper2)
{
this.oper1=oper1;
this.oper2=oper2;
}
public double calculate(String str)
{
if(str.equals("+"))
{
return oper1+oper2;
}
else if(str.equals("-"))
{
return oper1-oper2;
}
else if(str.equals("*"))
{
return oper1*oper2;
}
else if(str.equals("/"))
{
return oper1/oper2;
}
else
return 0;
}
public static void main(String[] args)
{
Calculator c=new Calculator(1.5,3.0);
System.out.println("加法(1.5+3.0):"+c.calculate("+"));
System.out.println("减法(1.5-3.0):"+c.calculate("-"));
System.out.println("乘法(1.5*3.0):"+c.calculate("*"));
System.out.println("加法(1.5/3.0):"+c.calculate("/"));
}
}