日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

[转载] JAVA语言程序设计(基础篇)第十版课后题答案(第一章)

發(fā)布時間:2025/3/11 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 [转载] JAVA语言程序设计(基础篇)第十版课后题答案(第一章) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

參考鏈接: Java中的Scanner和nextChar()

JAVA語言程序設(shè)計(基礎(chǔ)篇)第十版課后題答案 第一章 第二題 /**?

?Created by ysy on 2018/7/6. */ public class text2 { public static void main(String[] args){ for(int i = 0; i < 5; i++) System.out.println(“Welcome to Java”); }??

}?

第三題 /**?

Created by ysy on 2018/7/6. */ public class text3 { public static void main(String[] args){ System.out.println(" J A V V A"); System.out.println(" J A A V V A A"); System.out.println(“J J AAAAA V V AAAAA”); System.out.println(" JJ A A V A A"); } } 第四題 import java.util.Scanner;?

/**?

?Created by ysy on 2018/7/6. *對輸入數(shù)據(jù)求解一次方,平方,三次方 */ public class text4 { public static void main(String[] args){? Scanner input = new Scanner(System.in);

?char[] temp = new char[10];

?int num;

?for(int i = 0; i < 5; ++i){

? ? ?String Stemp;

? ? ?System.out.println("請輸入數(shù)據(jù):");

? ? ?Stemp = input.next();

? ? ?temp = Stemp.toCharArray();

? ? ?if(temp[0] >= 'a' && temp[0] <= 'z'){

? ? ? ? ?System.out.println(temp[0]+"? ? "+temp[0]+"^2? ? " + temp[0] + "^3");

? ? ?}

? ? ?else if(temp[0] >= '0' && temp[0] <= '9'){

? ? ? ? ?num = temp[0] - '0';

? ? ? ? ?System.out.println(num+"? ? "+(int)Math.pow(num, 2)+"? ? "+(int)Math.pow(num, 3));

? ? ?}

?

?}

?} }??

第七題 import java.util.Scanner;?

/**?

?Created by ysy on 2018/7/6. *對輸入數(shù)據(jù)求解一次方,平方,三次方 */ public class text4 { public static void main(String[] args){? Scanner input = new Scanner(System.in);

?char[] temp = new char[10];

?int num;

?for(int i = 0; i < 5; ++i){

? ? ?String Stemp;

? ? ?System.out.println("請輸入數(shù)據(jù):");

? ? ?Stemp = input.next();

? ? ?temp = Stemp.toCharArray();

? ? ?if(temp[0] >= 'a' && temp[0] <= 'z'){

? ? ? ? ?System.out.println(temp[0]+"? ? "+temp[0]+"^2? ? " + temp[0] + "^3");

? ? ?}

? ? ?else if(temp[0] >= '0' && temp[0] <= '9'){

? ? ? ? ?num = temp[0] - '0';

? ? ? ? ?System.out.println(num+"? ? "+(int)Math.pow(num, 2)+"? ? "+(int)Math.pow(num, 3));

? ? ?}

?

?}

?} }??

第八題?

/**?

?Created by ysy on 2018/7/6. */ public class text8 { static double pi=3.14; public static void main(String arg[]){? double r=5.5;

?double a=getLength(r);

?double b=getArea(r);

?System.out.println("周長:"+a);

?System.out.println("面積:"+b);

?} public static double getLength(double r){ return 2rpi; } public static double getArea(double r){ return rrpi; }??

}?

第九題 /**?

Created by ysy on 2018/7/6. */ public class text9 { public static void main(String[] arg){ double a=14/1.6; double t=45.5/60; double v=a/t; System.out.println(“速度”+v); } }?

第十一題?

/**?

Created by ysy on 2018/7/6. / public class text11 { public static void main(String arg[]){ int now_num=312032486; int time=365246060; int spring=time/7; int die=time/13; int move=time/45; int num=now_num+spring-die+move; System.out.println(num); } }?

第十二題?

/**?

?Created by ysy on 2018/7/6. / public class text12 { public static void main(String[] arg){ double a=3.4; double b=50.24; double c=2.1; double d=0.55; double e=44.5; double f=5.9; double x=(ed-bf)/(ad-bc); double y=(af-ec)/(ad-b*c); System.out.println(“x:”+x); System.out.println(“y:”+y); } }

總結(jié)

以上是生活随笔為你收集整理的[转载] JAVA语言程序设计(基础篇)第十版课后题答案(第一章)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。