類與對象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("/"));
}
}