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

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

java實驗四源代碼 java實驗原理

求JAVA源代碼

import java.util.ArrayList;

成都創(chuàng)新互聯(lián)公司成都網(wǎng)站建設(shè)按需網(wǎng)站制作,是成都網(wǎng)站開發(fā)公司,為石牌坊提供網(wǎng)站建設(shè)服務(wù),有成熟的網(wǎng)站定制合作流程,提供網(wǎng)站定制設(shè)計服務(wù):原型圖制作、網(wǎng)站創(chuàng)意設(shè)計、前端HTML5制作、后臺程序開發(fā)等。成都網(wǎng)站制作熱線:13518219792

import java.util.List;

import java.util.Scanner;

public class GradeStatistic {

public static void main(String[] args) {

GradeStatistic gs = new GradeStatistic();

ListMark list = new ArrayListMark();

float sum = 0;

while(true){

Scanner sc = new Scanner(System.in);

System.out.print("Please input student name: ");

String name = sc.nextLine();

if(name.equals("end")){

break;

}

System.out.print("Please input student score: ");

float score = sc.nextFloat();

sum += score;

list.add(gs.new Mark(name, score));

}

float max = list.get(0).getScore();

float min = list.get(0).getScore();

for(Mark mark: list){

if(max mark.getScore()){

max = mark.getScore();

}

if(min mark.getScore()){

min = mark.getScore();

}

}

float average = sum / list.size();

System.out.println("Average is: " + average);

System.out.println("Max is: " + max);

System.out.println("Min is: " + min);

}

private class Mark{

private String name;

private float score;

public Mark(String name, float score){

this.name = name;

this.score = score;

}

public String getName() {

return name;

}

public float getScore() {

return score;

}

}

}

----------------------

Please input student name: Zhang san

Please input student score: 100

Please input student name: Li Si

Please input student score: 91

Please input student name: Ec

Please input student score: 35

Please input student name: ma qi

Please input student score: 67

Please input student name: end

Average is: 73.25

Max is: 100.0

Min is: 35.0

java求源代碼

你是青鳥的吧?這我寫過?有源碼?這里怎么上傳壓縮包啊

package?ghhh;

import?java.util.Scanner;

public?class?DvD?{

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

int?state[]=new??int[6];

String?name[]=new??String[6];

int?date[]=new?int[6];

int?count[]=new?int?[6];

name[0]="權(quán)利的游戲";

name[1]="命運之夜";

name[2]="傲慢與偏見";

state[0]=1;

state[1]=0;

state[2]=1;

date[0]=13;

date[1]=0;

date[2]=9;

count[0]=23;

count[1]=23;

count[2]=23;

int?n;

// boolean?n=false;

do{

System.out.println("歡迎使用迷你DVD管理器");

System.out.println("1.新增DVD");

System.out.println("2.查看DVD");

System.out.println("3.刪除DVD");

System.out.println("4.借出DVD");

System.out.println("5.歸還DVD");

System.out.println("6.退出DVD");

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

System.out.println("請選擇:");

?n=input.nextInt();

switch(n){

case?1:

System.out.println("請輸入要增加DVD的名稱:");

String?name1=input.next();

boolean?flag=false;

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

if(name[i]==null){

name[i]=name1;

flag=true;

break;

}

}

if(flag){

System.out.println("新增DVD"+name1+"成功");

}else{

System.out.println("貨架已滿!增加失??!");

}

System.out.println("請輸入0返回!");

n=input.nextInt();

break;

case?2:

System.out.println("序號\t"+"狀態(tài)\t"+"名稱\t\t"+"借出日期\t"+"借出次數(shù)");

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

if(name[i]!=null){

String?state1?=((state[i]==0)?"可借":"已借");

String?date1=((date[i]==0)?"":date[i]+"日");

String?count1=count[i]+"次";

System.out.println((i+1)+"\t"+state1+"\t"+name[i]+"\t"+date1+"\t\t"+count1);

}

}

System.out.println("請輸入0返回!");

n=input.nextInt();

break;

case?3:

System.out.println("請輸入要刪除的DVD名稱:");

String?name2=input.next();

int?index=-1;

boolean?a=false;

boolean?flag1=false;

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

if(name2.equals(name[i])state[i]==1){

System.out.println("此DVD已經(jīng)借出,無法刪除");

a=true;

break;

}else?if(name2.equals(name[i])state[i]==0){

a=true;

index=i;

flag1=true;

System.out.println("刪除成功!");

break;

}

}

if(a==false){

System.out.println("沒有找到相同名稱的DVD!");

}

if(flag1){

for?(int?i=index;iname.length;i++){

if(i!=name.length-1){

name[i]=name[i+1];

state[i]=state[i+1];

date[i]=date[i+1];

count[i]=count[i+1];

}

name[name.length-1]=null;

state[name.length-1]=0;

date[name.length-1]=0;

count[name.length-1]=0;

}

}

System.out.println("請輸入0返回!");

n=input.nextInt();

break;

case?4:

System.out.println("請輸入要借出的DVD:");

?String?name3=input.next();

?boolean?a3=false;

?boolean?b3=false;

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

?if(name3.equals(name[i])??state[i]==1){

?System.out.println("該DVD已經(jīng)借出");

?a3=true;

?}else?if(name3.equals(name[i])??state[i]==0){

?do{

?System.out.println("請輸入借出的日期:");

int?m=input.nextInt();

?

?if(m31||m1){

?System.out.println("請重新輸入日期:");

?b3=true;

?}else{

?date[i]=m;?

?state[i]=1;

?count[i]+=1;

?}

?

?}while(b3==true);

?System.out.println("借出成功!");

?a3=true;

?}

?}

?if(a3==false){

?System.out.println("沒有該DVD");

?}

?System.out.println("請輸入0返回!");

?n=input.nextInt();

break;

case?5:

System.out.println("請輸入要歸還的DVD:");

String?name5=input.next();

boolean?b5=false;

boolean?m5=false;

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

if(name5.equals(name[i])??state[i]==1){

b5=true;

do{

System.out.println("請輸入要歸還DVD的日期:(歸還日期請輸入當月日期?1~31)");

int?a5=input.nextInt();

if(a531){

System.out.println("請重新輸入日期:");

m5=true;

}else?if(a5date[i]){

System.out.println("借出日期是"+date[i]+"日\t輸入的日期不能小于借出的日期,請重新輸入日期:");

m5=true;

}else{

state[i]=0;

System.out.println("歸還成功");

System.out.println("借出日期是:"+date[i]+"歸還日期是:"+a5+"日\t租金一天一元:共"+(a5-date[i])+"元");

???date[i]=0;

???m5=false;

}

}while(m5==true);

}else?if?(name5.equals(name[i])??state[i]==0){

System.out.println("該DVD未借出,不可歸還!");

b5=true;

}

}

if(b5==false){

System.out.println("沒有該名稱的DVDV");

}

System.out.println("請輸入0返回!");

?n=input.nextInt();

break;

case?6:

n=1;

System.out.println("程序退出!");

break;

default:

if(n==0){

}else{

System.out.println("輸入錯誤!請重新輸入!");

n=0;

}

break;

}

}while(n==0);

System.out.println("謝謝使用!");

}

}

看看有沒有問題 好久之前的了

給段最簡單的java代碼 讓我新手看一下

最簡單的java代碼肯定就是這個了,如下:

public class MyFirstApp

{

public static void main(String[] args)

{

System.out.print("Hello world");

}

}

“hello world”就是應(yīng)該是所有學java的新手看的第一個代碼了。如果是零基礎(chǔ)的新手朋友們可以來我們的java實驗班試聽,有免費的試聽課程幫助學習java必備基礎(chǔ)知識,有助教老師為零基礎(chǔ)的人提供個人學習方案,學習完成后有考評團進行專業(yè)測試,幫助測評學員是否適合繼續(xù)學習java,15天內(nèi)免費幫助來報名體驗實驗班的新手快速入門java,更好的學習java!


新聞標題:java實驗四源代碼 java實驗原理
本文地址:http://weahome.cn/article/doedgsd.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部