真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

java編程代碼圖 java繪圖程序代碼

如何用Java程序編程以下圖片的代碼

按照你的要求編寫的Java程序如下

創(chuàng)新互聯(lián)建站是一家集網(wǎng)站建設(shè),班戈企業(yè)網(wǎng)站建設(shè),班戈品牌網(wǎng)站建設(shè),網(wǎng)站定制,班戈網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,班戈網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

public?class?CC?{

public?static?void?main(String[]?args)?{

int?N=5;

for(int?i=0;iN;i++){

for(int?j=0;jN-i;j++){

System.out.print("?");

}

for(int?j=0;j=i;j++){

System.out.print((char)('a'+i)+"?");

}

System.out.println();

}

}

}

運(yùn)行結(jié)果

三道java編程題。求全部代碼和執(zhí)行截圖。

public class JavaPractise {

public static void main(String[] args) {

JavaPractise o = new JavaPractise();

String str = "1342973451345";

String subStr = o.getMaxLengthAddPart(str);

System.out.println(subStr);

String binaryFlow = "000011110000011111";

String sameSubStr = o.getMaxSameSubStr(binaryFlow);

System.out.println(sameSubStr);

String letterFlow = "aaBBBcCCCCddddddEEEE";

String sameLettersSubStr = o.getMaxSameLettersSubStr(letterFlow);

System.out.println(sameLettersSubStr);

}

/**

* 校驗(yàn)字符串是否符合數(shù)字規(guī)范

* */

private boolean isNum(String str){

boolean result = true;

if(str.length() 1)

return false;

for(int i = 0 ; i str.length(); i ++){

if(str.charAt(i) '0' || ?str.charAt(i) '9')

return false;

}

return result;

}

private boolean isBinaryFlow(String binaryFlow){

boolean result = true;

if(binaryFlow.length() 1)

return false;

for(int i = 0 ; i binaryFlow.length(); i ++){

if(binaryFlow.charAt(i) != ?'0' ?binaryFlow.charAt(i) != '1')

return false;

}

return result;

}

private boolean isLetterFlow(String letterFlow){

boolean result = true;

if(letterFlow.length() 1)

return false;

for(int i = 0 ; i letterFlow.length(); i ++){

char cur = letterFlow.charAt(i);

if(!( ('z'= cur cur = 'a') || ('Z' = cur cur 'A') ) )

return false;

}

return result;

}

/**

* 獲取最長(zhǎng)增長(zhǎng)數(shù)字的子串

* */

private String getMaxLengthAddPart(String str){

str = str.trim();

if(!isNum(str))

return "";

String temp = ""+str.charAt(0);

String maxSubStr = temp;

for(int i = 1; i str.length(); i++){

char curChar = str.charAt(i);

char lastChar = str.charAt(i-1);

if( curChar lastChar){

temp += curChar;

if(i != (str.length()-1))

continue;//如果當(dāng)前節(jié)點(diǎn)為最后一個(gè)節(jié)點(diǎn),那么強(qiáng)制進(jìn)入下面環(huán)節(jié),進(jìn)行

}

maxSubStr = maxSubStr.length() temp.length() ? maxSubStr : temp;

temp = ""+curChar; //清空原數(shù)據(jù),并從當(dāng)前節(jié)點(diǎn)記錄

}

return maxSubStr;

}

/**

* 二進(jìn)制流最長(zhǎng)字符串判定

* */

private String getMaxSameSubStr(String str){

str = str.trim();

if(!isBinaryFlow(str))

return "";

String temp = ""+str.charAt(0);

String maxSubStr = temp;

for(int i = 1; i str.length(); i++){

char curChar = str.charAt(i);

char lastChar = str.charAt(i-1);

if( curChar == lastChar){

temp += curChar;

if(i != (str.length()-1))

continue;//如果當(dāng)前節(jié)點(diǎn)為最后一個(gè)節(jié)點(diǎn),那么強(qiáng)制進(jìn)入下面環(huán)節(jié),進(jìn)行

}

maxSubStr = maxSubStr.length() temp.length() ? maxSubStr : temp;

temp = ""+curChar; //清空原數(shù)據(jù),并從當(dāng)前節(jié)點(diǎn)記錄

}

return maxSubStr;

}

/**

* 字符串的最長(zhǎng)相同部分截取

* */

private String getMaxSameLettersSubStr(String str){

str = str.trim();

if(!isLetterFlow(str))

return "";

String temp = ""+str.charAt(0);

String maxSubStr = temp;

for(int i = 1; i str.length(); i++){

char curChar = str.charAt(i);

char lastChar = str.charAt(i-1);

if( curChar == lastChar){

temp += curChar;

if(i != (str.length()-1))

continue;//如果當(dāng)前節(jié)點(diǎn)為最后一個(gè)節(jié)點(diǎn),那么強(qiáng)制進(jìn)入下面環(huán)節(jié),進(jìn)行

}

maxSubStr = maxSubStr.length() temp.length() ? maxSubStr : temp;

temp = ""+curChar; //清空原數(shù)據(jù),并從當(dāng)前節(jié)點(diǎn)記錄

}

return maxSubStr;

}

}

運(yùn)行結(jié)果如下:

用java編寫下圖的程序,詳細(xì)程序代碼

我使用eclipse寫的這個(gè)練習(xí),首先給你截個(gè)圖,抹掉的地方不是這個(gè)題的范疇,光標(biāo)擋住的地方是ModelScore

然后,先是ModelScore代碼:

package?Models;

public?class?ModelScore?{

private?double?mathScore;

private?double?englishScore;

private?double?javaScore;

private?static?final?int?type_Math?=?0,?type_English?=?1,?type_Java?=?2;

public?ModelScore(){

}

public?int?getNumberOfField(){

return?3;

}

public?ModelScore(double?mathScore,?double?englishScore,?double?javaScore){

this.mathScore?=?mathScore;

this.englishScore?=?englishScore;

this.javaScore?=?javaScore;

}

public?double?getMathScore(){

return?this.mathScore;

}

public?double?getEnglishScore(){

return?this.englishScore;

}

public?double?getJavaScore(){

return?this.javaScore;

}

public?void?setMathScore(double?mathScore){

this.mathScore?=?mathScore;

}

public?void?setEnglishScore(double?englishScore){

this.englishScore?=?englishScore;

}

public?void?setJavaScore(double?javaScore){

this.javaScore?=?javaScore;

}

public?double?getAverageScore(){

return?(double)Math.round((this.mathScore?+?this.englishScore?+?this.javaScore)?/?3?*?100)?/?100;

}

public?String?toString(){

return?"Scores:[Math:?"?+?getMathScore()?+?

",?English:?"?+?getEnglishScore()?+?",?Java:?"?+?getJavaScore()?+?

",?AverageScore:?"?+?getAverageScore()?+?"]";

}

public?ModelScore?clone(){

ModelScore?score?=?new?ModelScore();

score.setMathScore(this.getMathScore());

score.setEnglishScore(this.getEnglishScore());

score.setJavaScore(this.getJavaScore());

return?score;

}

public?double?getScore(int?type){

if(type?==?type_Math){

return?mathScore;

}

if(type?==?type_English){

return?englishScore;

}

if(type?==?type_Java){

return?javaScore;

}

return?0;

}

}

然后是ModelStudent代碼:

package?Models;

public?class?ModelStudent?{

private?String?studentID;

private?String?studentName;

private?ModelScore?score;

public?ModelStudent(){

}

public?ModelStudent(String?studentID,?String?studentName,?ModelScore?score){

this.studentID?=?studentID;

this.studentName?=?studentName;

this.score?=?score.clone();

}

public?String?getStudentID(){

return?this.studentID;

}

public?String?getStudentName(){

return?this.studentName;

}

public?ModelScore?getStudentScore(){

return?this.score.clone();

}

public?void?setStudentID(String?studentID){

this.studentID?=?studentID;

}

public?void?setStudentName(String?studentName){

this.studentName?=?studentName;

}

public?void?setStudentScore(ModelScore?score){

this.score?=?score.clone();

}

public?double?getAverageScore(){

return?score.getAverageScore();

}

public?ModelStudent?clone(){

ModelStudent?student?=?new?ModelStudent();

student.setStudentID(studentID);

student.setStudentName(studentName);

student.setStudentScore(score.clone());

return?student;

}

public?String?toString(){

return?"Student:[?ID:?"?+?getStudentID()?+?",?Name:?"

+?getStudentName()?+?",?"?+?getStudentScore()?+?"]";

}

public?String?getNameAndEverayScore(){

return?"Name:?"?+?studentName?+?",?average?score:?"?+?getAverageScore();

}

}

最后是主函數(shù)所在的類StudentScoreTester代碼:

import?java.util.ArrayList;

import?java.util.Scanner;

import?Models.ModelScore;

import?Models.ModelStudent;

public?class?StudentScoreTester?{

static?final?int?type_Math?=?0,?type_English?=?1,?type_Java?=?2?;

public?static?void?main(String[]?args)?throws?NumberFormatException{

Scanner?input?=?new?Scanner(System.in);

String?studentID?=?"?",?studentName,?searchedStudentName;

double?studentMathScore,?studentEnglishScore,?studentJavaScore;

ModelScore?studentScore;

ModelStudent?student;

ArrayListModelStudent?students?=?new?ArrayListModelStudent();

ArrayListModelStudent?studentsWithMaxMath,?studentsWithMinMath;

ArrayListModelStudent?studentsWithMaxEnglish,?studentsWithMinEnglish;

ArrayListModelStudent?studentsWithMaxJava,?studentsWithMinJava;

ArrayListModelStudent?searchedStudents;

double[]?averageScores;

double?averageScoreForMath,?averageScoreForEnglish,?averageScoreForJava;

double?maxScoreForMath,?maxScoreForEnglish,?maxScoreForJava;

double?minScoreForMath,?minScoreForEnglish,?minScoreForJava;

while(!studentID.equalsIgnoreCase("end")){

System.out.print("輸入若干學(xué)生的學(xué)號(hào),姓名,以及三科成績(jī)(數(shù)學(xué),英語,Java),?以輸入end作為結(jié)束輸入:");

studentID?=?input.next();

if(studentID.equalsIgnoreCase("end")){

break;

}

studentName?=?input.next();

studentMathScore?=?Double.valueOf(input.next());

studentEnglishScore?=?Double.valueOf(input.next());

studentJavaScore?=?Double.valueOf(input.next());

studentScore?=?new?ModelScore(studentMathScore,?studentEnglishScore,?studentJavaScore);

student?=?new?ModelStudent(studentID,?studentName,?studentScore);

students.add(student);

}

System.out.println("*******************************");

System.out.println("計(jì)算出所有學(xué)生平均成績(jī),并以降序顯示......");

sortByAverageScore(students);

for(ModelStudent?everyStudent:?students){

System.out.println(everyStudent.getNameAndEverayScore());

}

System.out.println("*******************************");

System.out.println("全組每科平均成績(jī)......");

averageScores?=?calculateAverageScore(students);

averageScoreForMath?=?averageScores[type_Math];

averageScoreForEnglish?=?averageScores[type_English];

averageScoreForJava?=?averageScores[type_Java];

System.out.println("數(shù)學(xué):?"?+?averageScoreForMath);

System.out.println("英語:?"?+?averageScoreForEnglish);

System.out.println("Java:?"?+?averageScoreForJava);

System.out.println("*******************************");

System.out.println("每科最好以及最差成績(jī)的學(xué)生......");

studentsWithMaxMath?=?findStudentWithMaxScore(students,?type_Math);

studentsWithMinMath?=?findStudentWithMinScore(students,?type_Math);

studentsWithMaxEnglish?=?findStudentWithMaxScore(students,?type_English);

studentsWithMinEnglish?=?findStudentWithMinScore(students,?type_English);

studentsWithMaxJava?=?findStudentWithMaxScore(students,?type_Java);

studentsWithMinJava?=?findStudentWithMinScore(students,?type_Java);

System.out.println("??????#########################");

System.out.println("數(shù)學(xué)最高成績(jī)......");

for(ModelStudent?studentWithMaxMath:?studentsWithMaxMath){

System.out.println(studentWithMaxMath.getStudentName()?+?",?"?+?studentWithMaxMath.getStudentScore().getScore(type_Math));

}

System.out.println("\n數(shù)學(xué)最低成績(jī)......");

for(ModelStudent?studentWithMinMath:?studentsWithMinMath){

System.out.println(studentWithMinMath.getStudentName()?+?",?"?+?studentWithMinMath.getStudentScore().getScore(type_Math));

}

System.out.println("??????#########################");

System.out.println("英語最高成績(jī)......");

for(ModelStudent?studentWithMaxEnglish:?studentsWithMaxEnglish){

System.out.println(studentWithMaxEnglish.getStudentName()?+?",?"?+?studentWithMaxEnglish.getStudentScore().getScore(type_English));

}

System.out.println("\n英語最低成績(jī)......");

for(ModelStudent?studentWithMinEnglish:?studentsWithMinEnglish){

System.out.println(studentWithMinEnglish.getStudentName()?+?",?"?+?studentWithMinEnglish.getStudentScore().getScore(type_English));

}

System.out.println("??????#########################");

System.out.println("Java最高成績(jī)......");

for(ModelStudent?studentWithMaxJava:?studentsWithMaxJava){

System.out.println(studentWithMaxJava.getStudentName()?+?",?"?+?studentWithMaxJava.getStudentScore().getScore(type_Java));

}

System.out.println("\nJava最低成績(jī)......");

for(ModelStudent?studentWithMinJava:?studentsWithMinJava){

System.out.println(studentWithMinJava.getStudentName()?+?",?"?+?studentWithMinJava.getStudentScore().getScore(type_Java));

}

System.out.println("*******************************");

System.out.print("輸入要查找的學(xué)生姓名:?");

input.nextLine();

searchedStudentName?=?input.nextLine();

searchedStudents?=?searchStudentsByName(students,?searchedStudentName);

System.out.println("查找結(jié)果是......");

if(searchedStudents.size()?!=?0){

for(ModelStudent?everyStudent:?searchedStudents){

System.out.println(everyStudent);

}

}

else{

System.out.println("查無此學(xué)生");

}

}

public?static?void?sortByAverageScore(ArrayListModelStudent?students){

for(int?i?=?0;?i??students.size()?-?1;?i++){

for(int?j?=?i;?j??students.size();?j++){

if(students.get(i).getAverageScore()??students.get(j).getAverageScore()){

ModelStudent?tempStudent?=?students.get(i);

students.set(i,?students.get(j));

students.set(j,?tempStudent);

}

}

}

}

public?static?double[]?calculateAverageScore(ArrayListModelStudent?students){

double[]?averageScore?=?new?double[students.get(0).getStudentScore().getNumberOfField()];

for(int?i?=?0;?i??students.size();?i++){

ModelStudent?currentStudent?=?students.get(i);

averageScore[type_Math]?+=?currentStudent.getStudentScore().getMathScore();

averageScore[type_English]?+=?currentStudent.getStudentScore().getEnglishScore();

averageScore[type_Java]?+=?currentStudent.getStudentScore().getJavaScore();

}

averageScore[type_Math]?=?(double)Math.round(averageScore[type_Math]/?students.size()?*?100)?/?100;

averageScore[type_English]?=?(double)Math.round(averageScore[type_English]/?students.size()?*?100)?/?100;

averageScore[type_Java]?=?(double)Math.round(averageScore[type_Java]/?students.size()?*?100)?/?100;

return?averageScore;

}

public?static?ArrayListModelStudent?findStudentWithMaxScore(ArrayListModelStudent?students,?int?type){

ArrayListModelStudent?studentsWithMaxScore?=?new?ArrayListModelStudent();

ModelStudent?studentWithMaxScore?=?students.get(0);

for(ModelStudent?everyStudent:?students){

if(studentWithMaxScore.getStudentScore().getScore(type)??everyStudent.getStudentScore().getScore(type)){

studentWithMaxScore?=?everyStudent.clone();

}

}

for(ModelStudent?everyStudent:?students){

if(studentWithMaxScore.getStudentScore().getScore(type)?==?everyStudent.getStudentScore().getScore(type)){

studentsWithMaxScore.add(everyStudent);

}

}

return?studentsWithMaxScore;

}

public?static?ArrayListModelStudent?findStudentWithMinScore(ArrayListModelStudent?students,?int?type){

ArrayListModelStudent?studentsWithMaxScore?=?new?ArrayListModelStudent();

ModelStudent?studentWithMaxScore?=?students.get(0);

for(ModelStudent?everyStudent:?students){

if(studentWithMaxScore.getStudentScore().getScore(type)??everyStudent.getStudentScore().getScore(type)){

studentWithMaxScore?=?everyStudent.clone();

}

}

for(ModelStudent?everyStudent:?students){

if(studentWithMaxScore.getStudentScore().getScore(type)?==?everyStudent.getStudentScore().getScore(type)){

studentsWithMaxScore.add(everyStudent);

}

}

return?studentsWithMaxScore;

}

public?static?ArrayListModelStudent?searchStudentsByName(ArrayListModelStudent?students,?String?studentName){

ArrayListModelStudent?resultStudents?=?new?ArrayListModelStudent();

for(ModelStudent?everyStudent:?students){

if(everyStudent.getStudentName().equals(studentName)){

resultStudents.add(everyStudent);

}

}

return?resultStudents;

}

}

怎么為Java程序添加背景圖片代碼?

僅僅是給窗口添加背景的話是很簡(jiǎn)單的,添加上以下語句(自己去添加變量哈):\x0d\x0a\x0d\x0alabel = new JLabel(background); //background為ImageIcon\x0d\x0a// 把標(biāo)簽的大小位置設(shè)置為圖片剛好填充整個(gè)面板 \x0d\x0alabel.setBounds(0, 0, this.getWidth(), this.getHeight());\x0d\x0a//添加圖片到frame的第二層(把背景圖片添加到分層窗格的最底層作為背景)\x0d\x0athis.getLayeredPane().add(label,new Integer(Integer.MIN_VALUE));\x0d\x0a//把內(nèi)容窗格轉(zhuǎn)化為JPanel,否則不能用方法setOpaque()來使內(nèi)容窗格透明\x0d\x0ajPanel=(JPanel)this.getContentPane();\x0d\x0a//設(shè)置透明\x0d\x0ajPanel.setOpaque(false);\x0d\x0a\x0d\x0a然后你上面那個(gè)JPanel p也設(shè)置成透明就可以了

JAVA 編程,算法,詳細(xì)在圖里, 求代碼、詳細(xì)解答?

(a)It is insert sort algorithm of the above code segment.上面的代碼是插入排序算法

(b)

EXAMPLE

AEXMPLE

AEMXPLE

AEMPXLE

AELMPXE

AEELMPX

(c)

Require 6 sorting steps.

補(bǔ)充完整的插入排序算法的Java程序如下

public class A{

public static void main(String[] args){

char[] a={'E','X','A','M','P','L','E'};

char v;

int i,j,n=a.length,count=0;

for (i =1; i n; i++){

v = a[i];

j = i;

while(j 0 a[j-1] v) {

a[j] = a[j-1];

j--;

}

a[j] = v;

count++;

System.out.println(new String(a));

}

System.out.println("Require "+count+" sorting steps.");

}

}

JAVA 編程,算法,編寫一個(gè)名為StackExtension的類來擴(kuò)展LinkedStack, 詳細(xì)在圖里,求代碼、詳細(xì)解答?

StackExtension類我測(cè)試過了,沒有問題.

完整的StackExtension類如下

import dataStructures.LinkedStack;

public class StackExtension extends LinkedStack{

public int sum(){

int n=0;

int size=super.size();

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

n=n+Integer.parseInt(String.valueOf(super.pop()));

}

return n;

}

public String displayPalindromes(){

String s="";

int size=super.size();

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

s=s+String.valueOf(super.get(i))+" ";

}

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

s=s+String.valueOf(super.pop())+" ";

}

return s;

}

}

運(yùn)行結(jié)果


當(dāng)前題目:java編程代碼圖 java繪圖程序代碼
文章位置:http://weahome.cn/article/hjipeh.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部