原理上面不都有了么。。。
創(chuàng)新互聯(lián)不只是一家網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司;我們對營銷、技術(shù)、服務(wù)都有自己獨(dú)特見解,公司采取“創(chuàng)意+綜合+營銷”一體化的方式為您提供更專業(yè)的服務(wù)!我們經(jīng)歷的每一步也許不一定是最完美的,但每一步都有值得深思的意義。我們珍視每一份信任,關(guān)注我們的成都網(wǎng)站建設(shè)、成都做網(wǎng)站質(zhì)量和服務(wù)品質(zhì),在得到用戶滿意的同時(shí),也能得到同行業(yè)的專業(yè)認(rèn)可,能夠?yàn)樾袠I(yè)創(chuàng)新發(fā)展助力。未來將繼續(xù)專注于技術(shù)創(chuàng)新,服務(wù)升級,滿足企業(yè)一站式成都營銷網(wǎng)站建設(shè)需求,讓再小的成都品牌網(wǎng)站建設(shè)也能產(chǎn)生價(jià)值!
好吧,我解釋一下:
d=3000 '圓的半徑
For i = 0 To 100 ‘畫100個(gè)不同半徑的圓
Circle (3200, 3200), d, RGB(255, 0, 0), 0, 3.14 ‘從點(diǎn)3200,3200開始畫半徑為d(3000)的半圓
d = d - 1 ‘直徑變小一個(gè)點(diǎn)
Next i ‘沒畫到100個(gè)圓就繼續(xù)畫
我發(fā)個(gè)畫彩虹的代碼吧,執(zhí)行結(jié)果:
代碼:
Private?Sub?Command1_Click()
d?=?3000
For?i?=?0?To?100
Circle?(3200,?3200),?d,?RGB(255,?0,?0),?0,?3.14
d?=?d?-?1
Next?i
For?i?=?0?To?100
Circle?(3200,?3200),?d,?RGB(255,?165,?0),?0,?3.14
d?=?d?-?1
Next?i
For?i?=?0?To?100
Circle?(3200,?3200),?d,?RGB(255,?255,?0),?0,?3.14
d?=?d?-?1
Next?i
For?i?=?0?To?100
Circle?(3200,?3200),?d,?RGB(0,?255,?0),?0,?3.14
d?=?d?-?1
Next?i
For?i?=?0?To?100
Circle?(3200,?3200),?d,?RGB(0,?127,?255),?0,?3.14
d?=?d?-?1
Next?i
For?i?=?0?To?100
Circle?(3200,?3200),?d,?RGB(0,?0,?255),?0,?3.14
d?=?d?-?1
Next?i
For?i?=?0?To?100
Circle?(3200,?3200),?d,?RGB(139,?0,?255),?0,?3.14
d?=?d?-?1
Next?i
End?Sub
先定義要漸變的顏色,然后試試這個(gè)
Graphics2D g2 = (Graphics2D) g;
//繪制漸變
g2.setPaint(new GradientPaint(
0, 0, new Color(116, 149, 226),
getWidth(), getHeight(),
new Color(199, 212, 247)
));
g2.fillRect(0, 0, getWidth(), getHeight());
public class TestStar {
public static void main(String[] args) {
String star = "*";
for (int i = 0; i 5; i++) {
if (i == 0) {
System.out.print(" " + star);
System.out.println();
}
if (i == 1) {
for (int z = 0; z 4; z++) {
System.out.print(" " + star);
}
System.out.println();
}
if (i == 2) {
System.out.print(" ");
for (int x = 0; x 3; x++) {
System.out.print(" " + star);
}
System.out.println();
}
if (i == 3) {
for (int y = 0; y 2; y++) {
System.out.print(" " + star + " ");
}
}
}
}
}
是好使的 但是我沒找到畫五角星有什么規(guī)律(五角星好象不是正規(guī)圖形吧?)如果還有什么要求的話 補(bǔ)充問題(如果是用*填充所有的東西 不包括 “ ”的話 我可以重新再給你寫一個(gè))
上面 wuzhikun12同學(xué)寫的不錯(cuò),但我想還不能運(yùn)行,并且還不太完善。我給個(gè)能運(yùn)行的:(注意:文件名為:Test.java)
//要實(shí)現(xiàn)對象間的比較,就必須實(shí)現(xiàn)Comparable接口,它里面有個(gè)compareTo方法
//Comparable最好使用泛型,這樣,無論是速度還是代碼量都會(huì)減少
@SuppressWarnings("unchecked")
class Student implements ComparableStudent{
private String studentNo; //學(xué)號
private String studentName; //姓名
private double englishScore; //英語成績
private double computerScore; //計(jì)算機(jī)成績
private double mathScore; //數(shù)學(xué)成績
private double totalScore; //總成績
//空構(gòu)造函數(shù)
public Student() {}
//構(gòu)造函數(shù)
public Student(String studentNo,String studentName,double englishSocre,double computerScore,double mathScore) {
this.studentNo = studentNo;
this.studentName = studentName;
this.englishScore = englishSocre;
this.computerScore = computerScore;
this.mathScore = mathScore;
}
//計(jì)算總成績
public double sum() {
this.totalScore = englishScore+computerScore+mathScore;
return totalScore;
}
//計(jì)算評測成績
public double testScore() {
return sum()/3;
}
//實(shí)現(xiàn)compareTO方法
@Override
public int compareTo(Student student) {
double studentTotal = student.getTotalScore();
return totalScore==studentTotal?0:(totalScorestudentTotal?1:-1);
}
//重寫toString方法
public String toString(){
return "學(xué)號:"+this.getStudentNo()+" 姓名:"+this.getStudentName()+" 英語成績:"+this.getEnglishScore()+" 數(shù)學(xué)成績:"+this.getMathScore()+" 計(jì)算機(jī)成績:"+this.getComputerScore()+" 總成績:"+this.getTotalScore();
}
//重寫equals方法
public boolean equals(Object obj) {
if(obj == null){
return false;
}
if(!(obj instanceof Student)){
return false;
}
Student student = (Student)obj;
if(this.studentNo.equals(student.getStudentName())) { //照現(xiàn)實(shí)來說,比較是不是同一個(gè)學(xué)生,應(yīng)該只是看他的學(xué)號是不是相同
return true;
} else {
return false;
}
}
/*以下為get和set方法,我個(gè)人認(rèn)為,totalScore的set的方法沒必要要,因?yàn)樗怯善渌煽冇?jì)算出來的
在set方法中,沒設(shè)置一次值,調(diào)用一次sum方法,即重新計(jì)算總成績
*/
public String getStudentNo() {
return studentNo;
}
public void setStudentNo(String studentNo) {
this.studentNo = studentNo;
sum();
}
public String getStudentName() {
return studentName;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
sum();
}
public double getEnglishScore() {
return englishScore;
}
public void setEnglishScore(double englishScore) {
this.englishScore = englishScore;
sum();
}
public double getComputerScore() {
return computerScore;
}
public void setComputerScore(double computerScore) {
this.computerScore = computerScore;
sum();
}
public double getMathScore() {
return mathScore;
}
public void setMathScore(double mathScore) {
this.mathScore = mathScore;
sum();
}
public double getTotalScore() {
return totalScore;
}
}
//Student子類學(xué)習(xí)委員類的實(shí)現(xiàn)
class StudentXW extends Student {
//重寫父類Student的testScore()方法
@Override
public double testScore() {
return sum()/3+3;
}
public StudentXW() {}
//StudentXW的構(gòu)造函數(shù)
public StudentXW(String studentNo,String studentName,double englishSocre,double computerScore,double mathScore) {
super(studentNo,studentName,englishSocre,computerScore,mathScore);
}
}
//Student子類班長類的實(shí)現(xiàn)
class StudentBZ extends Student {
//重寫父類Student的testScore()方法
@Override
public double testScore() {
return sum()/3+5;
}
public StudentBZ() {}
//StudentXW的構(gòu)造函數(shù)
public StudentBZ(String studentNo,String studentName,double englishSocre,double computerScore,double mathScore) {
super(studentNo,studentName,englishSocre,computerScore,mathScore);
}
}
//測試類
public class Test {
public static void main(String[] args) {
//生成若干個(gè)student類、StudentXW類、StudentBZ類
Student student1 = new Student("s001","張三",70.5,50,88.5);
Student student2 = new Student("s002","李四",88,65,88.5);
Student student3 = new Student("s003","王五",67,77,90);
StudentXW student4 = new StudentXW("s004","李六",99,88,99.5);
StudentBZ student5 = new StudentBZ("s005","朱漆",56,65.6,43.5);
Student[] students = {student1,student2,student3,student4,student5};
for(int i = 0 ; istudents.length; i++){
double avgScore = students[i].testScore();
System.out.println(students[i].getStudentName()+"學(xué)生的評測成績?yōu)椋?+ avgScore+"分");
}
}
}
運(yùn)行結(jié)果為:
張三學(xué)生的評測成績?yōu)椋?9.66666666666667分
李四學(xué)生的評測成績?yōu)椋?0.5分
王五學(xué)生的評測成績?yōu)椋?8.0分
李六學(xué)生的評測成績?yōu)椋?8.5分
朱漆學(xué)生的評測成績?yōu)椋?0.03333333333333分
分享題目:java畫彩虹源代碼 java繪制源碼
網(wǎng)頁URL:http://chinadenli.net/article46/hgdehg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器、Google、手機(jī)網(wǎng)站建設(shè)、虛擬主機(jī)、網(wǎng)站內(nèi)鏈、定制網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)