欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

編寫一段java程序代碼 java 程序編寫

用JAVA編寫一個程序,要求如下:

實現(xiàn)代碼如下:

成都創(chuàng)新互聯(lián)公司堅持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時代的柳北網(wǎng)站設(shè)計、移動媒體設(shè)計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

Student類:

public class Student {

private String name;

private String sex;

private int age;

private double chinese;

private double math;

private double english;

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getSex() {

return sex;

}

public void setSex(String sex) {

this.sex = sex;

}

public int getAge() {

return age;

}

public void setAge(int age) {

this.age = age;

}

public double getChinese() {

return chinese;

}

public void setChinese(double chinese) {

this.chinese = chinese;

}

public double getMath() {

return math;

}

public void setMath(double math) {

this.math = math;

}

public double getEnglish() {

return english;

}

public void setEnglish(double english) {

this.english = english;

}

}

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

StudentTest類:(測試類)

import java.util.Scanner;

public class StudentTest {

public static void main(String[] args) {

Student student = new Student();

Scanner sc = new Scanner(System.in);

System.out.println("請輸入姓名:");

student.setName(sc.next());

System.out.println("請輸入性別:");

student.setSex(sc.next());

System.out.println("請輸入年齡:");

student.setAge(sc.nextInt());

System.out.println("請輸入語文成績、數(shù)學(xué)成績、英語成績:");

student.setChinese(sc.nextDouble());

student.setMath(sc.nextDouble());

student.setEnglish(sc.nextDouble());

Double count = student.getChinese()+ student.getMath()+student.getEnglish();

System.out.println("姓名:"+student.getName()+" 性別:"+student.getSex()+" 年齡:"+student.getAge());

System.out.println("總分:"+count+" 平均分:"+count/3);

}

}

運行結(jié)果為:

根據(jù)以下任務(wù)要求,編寫Java應(yīng)用程序?

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

注意 請使用你的真實姓名和班級替換Test類中

創(chuàng)建Student對象stu時用的"張三"和"20計算機應(yīng)用01班"

import java.util.Scanner;

class Student{

private String name,classname;

private int starnum,scorenum;

private int[] scores;

public void setStarNum(int n){

this.starnum=n;

}

public Student(String name,String classname,int scorenum){

this.name=name;

this.classname=classname;

this.scorenum=scorenum;

}

public String getName(){

return this.name;

}

public void printStar(){

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

for(int j=0;j2*i+1;j++){

System.out.print("*");

}

System.out.println();

}

}

public void setScore(){

Scanner sc=new Scanner(System.in);

scores=new int[scorenum];

System.out.print("請輸入各科成績:");

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

scores[i]=sc.nextInt();

}

}

public void showInfo(){

System.out.print(name+"同學(xué),你所在的班級是"+classname+",你各科考試成績分別為:");

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

if(i==scorenum-1)

System.out.print(scores[i]);

else

System.out.print(scores[i]+",");

}

System.out.println();

}

public float getAvg(){

float sum=0;

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

sum=sum+scores[i];

}

return sum/scorenum;

}

}

public class Test{

public static void main(String[] args){

Student stu=new Student("張三","20計算機應(yīng)用01班",5);

stu.setStarNum(4);

stu.printStar();

stu.setScore();

stu.showInfo();

if(stu.getAvg()60){

System.out.println(stu.getName()+"是不合格學(xué)生");

}else{

System.out.println(stu.getName()+"是個合格學(xué)生");

}

}

}

用java寫一個程序?

import java.io.BufferedWriter;

import java.io.FileWriter;

import java.io.IOException;

public class PrimeNumberFinder {

public static void main(String[] args) {

// 設(shè)置范圍

int start = 20000000;

int end = 300000000;

// 用于寫入文件的 BufferedWriter

BufferedWriter writer = null;

try {

// 初始化 BufferedWriter

writer = new BufferedWriter(new FileWriter("primefile.dat"));

// 遍歷范圍內(nèi)的所有數(shù)字

for (int i = start; i = end; i++) {

// 如果這個數(shù)字是素數(shù),寫入文件

if (isPrime(i)) {

writer.write(String.valueOf(i));

writer.newLine();

}

}

} catch (IOException e) {

// 如果出現(xiàn) IOException,輸出錯誤信息

e.printStackTrace();

} finally {

// 最后關(guān)閉 BufferedWriter

if (writer != null) {

try {

writer.close();

} catch (IOException e) {

e.printStackTrace();

}

}

}

}

// 判斷一個數(shù)字是否為素數(shù)

public static boolean isPrime(int n) {

// 對于小于 2 的數(shù)字,直接返回 false

if (n 2) {

return false;

}

// 從 2 開始遍歷到 n-1,如果能被 n 整除,則返回 false

for (int i = 2; i n; i++) {

if (n % i == 0) {

return false;

}

}

// 如果執(zhí)行到這里,說明沒有小于 n 的數(shù)字能被 n 整除,返回 true

return true;

}

分享標題:編寫一段java程序代碼 java 程序編寫
當前鏈接:http://aaarwkj.com/article32/hhpipc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計公司、域名注冊、品牌網(wǎng)站設(shè)計、App開發(fā)建站公司、外貿(mào)網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)公司
欧美日韩黄片免费在线观看| 未满十八禁止在线播放| 日本区一区二区三视频| 亚洲一区二区精品自拍| 蜜桃av噜噜一区二区三| 久久一二三四区中文字幕| 久久一区二区视频在线观看| 黄色日韩大片在线观看| 在线观看国产一区二区不卡| 亚洲精品欧美综合二区| 精品国产一区二区av麻豆| 色婷婷国产精品久久包臀| 亚洲综合另类小说专区| 国产欧美成人精品第一区| 91九色国产老熟女乱子| 美女性生活免费视频网站 | 日韩欧美一区二区三区在线| 超碰97精品在线观看| 中文在线中文天堂黄色片| 国产精品自产拍av在线| 久久re这里只有精品6| 二区三区在线欧美日韩| 中文字幕亚洲入口久久| 琪琪精品免费一区二区三区| 亚洲一区二区婷婷久久| 亚洲欧美国产日韩天堂区| 91在线国产精品视频| 国产精品一区二区久久| 午夜福利激情视频在线| 成人性生活三级黄色片| 亚洲精品黄色片中文字幕| 久久 久久国内精品亚洲| 日韩精品在线观看视频一区二区三区 | 国产女主播精品视频一区| 欧美黄片在线免费观看视频 | 亚洲av蜜臀在线播放| 91九色蝌蚪国产欧美亚洲| 亚洲国产高清国产拍精品| 亚洲一二三无人区是什么| 国产传媒在线免费播放| 日韩精品极品在线视频观看免费|