java最全源代码 java开发实例大全源码
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]="权利的游戏";
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"+"名称\t\t"+"借出日期\t"+"借出次数");
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已经借出,无法删除");
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已经借出");
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新手,求完整的源代码
//都是从新手过来的,以下代码供参考
//1.
public class BankAccount {
private static String acctnum;
private static double money;
private static void showAcct() {
System.out.println("账号为: " + acctnum);
}
private static void showMoney() {
System.out.println("余额为: " + money);
}
public BankAccount(String acc, double m) {
this.acctnum = acc;
this.money = m;
}
public static void main(String[] args) {
BankAccount ba = new BankAccount("626600018888", 5000.00);
ba.showAcct();
ba.showMoney();
}
}
//2.
public class Triangle {
private static float a;
private static float b;
private static float c;
public Triangle(float a, float b, float c) {
this.a = a;
this.b = b;
this.c = c;
}
public static boolean judgeTriangle(float a, float b, float c) {
if ((a Math.abs(b - c) a b + c)
(b Math.abs(a - c) b a + c)
(c Math.abs(a - b) c a + b))
return true;
else
return false;
}
public float getCircumference() {
return this.a + this.b + this.c;
}
}
//3.
public class TestTriangle {
public static void main(String[] args) {
Triangle t = new Triangle(5.3f,7.8f,9.3f);
if(t.judgeTriangle(5.3f,7.8f,9.3f)){
System.out.print("能够成三角形,周长为: ");
System.out.printf("%9.2f",t.getCircumference());}
else
System.out.println("不能构成三角形");
}
}
求JAVA源代码
import java.util.ArrayList;
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怎么编写停车场管理系统源代码?
importjava.text.SimpleDateFormat;\x0d\x0aimportjava.util.Date;\x0d\x0aimportjava.util.Scanner;\x0d\x0a\x0d\x0a/*********************************\x0d\x0a*停车场管理\x0d\x0a*authorzhang\x0d\x0a*2013-12-13\x0d\x0a********************************/\x0d\x0apublicclassCarStopManager{\x0d\x0a\x0d\x0apublicstaticvoidmain(String[]args){\x0d\x0aScannersc=newScanner(System.in);\x0d\x0a\x0d\x0aSystem.out.println("请入车牌号:");\x0d\x0aStringcarno=sc.next();\x0d\x0aCarStopManagercarStopManager=newCarStopManager();\x0d\x0acarStopManager.setCarNo(carno);//设置车牌号\x0d\x0a\x0d\x0aSimpleDateFormatformat=newSimpleDateFormat("yyyy-MM-ddHH:mm:ss");\x0d\x0aStringsdate=format.format(newDate());\x0d\x0aSystem.out.println("当前时间(入场时间)是:"+sdate);\x0d\x0a\x0d\x0aSystem.out.println("需要开出车场吗?yes/no:");\x0d\x0aStringyesno=sc.next();\x0d\x0a\x0d\x0aif(yesno.equals("yes")){\x0d\x0aStringedate=format.format(newDate());\x0d\x0aSystem.out.println("出场时间是:"+edate);\x0d\x0a//计算方法\x0d\x0acarManager(2,sdate,edate,carStopManager);\x0d\x0a}\x0d\x0a}\x0d\x0a/**\x0d\x0a*计算方法\x0d\x0a*/\x0d\x0apublicstaticvoidcarManager(inttype,StringstarTime,\x0d\x0aStringendTime,CarStopManagercarStopManager){\x0d\x0a\x0d\x0aif(type==1){//按月收费\x0d\x0aSystem.out.println("如若没有缴纳月费请缴纳800元,如若缴纳将不再提示!");\x0d\x0a}else{\x0d\x0a/**\x0d\x0a*一般不会有停车几个月的吧?先不考虑停车几年或者几个月的\x0d\x0a*/\x0d\x0aStringsDay=starTime.substring(8,10);//入场日期(天)\x0d\x0aStringsHour=starTime.substring(11,13);//入场小时\x0d\x0aStringsMM=starTime.substring(14,16);//入场分钟\x0d\x0a\x0d\x0aStringeDay=starTime.substring(8,10);//出场日期(天)\x0d\x0aStringeHour=endTime.substring(11,13);//出厂小时\x0d\x0aStringeMM=endTime.substring(14,16);//出厂分钟\x0d\x0a\x0d\x0afloatmoney=0;//需缴纳的费用\x0d\x0aintshour=Integer.parseInt(sHour);\x0d\x0aintehour=Integer.parseInt(eHour);\x0d\x0aintsmm=Integer.parseInt(sMM);\x0d\x0aintemm=Integer.parseInt(eMM);\x0d\x0aintrehour=0;//停车几个小时\x0d\x0a\x0d\x0aif(sDay.equals(eDay)){//同一天\x0d\x0a//当天6点到20点之间\x0d\x0aif((shour=6shour
回答于 2022-12-14
java se的全部源代码哪里下载?
如果你已经安装了jdk的话,直接找到jdk的安装目录。有2个文件一个是jdk1.6(版本号) 一个是jre6(Java运行环境) 。进入jdk1.6文件夹下,找到src.zip的压缩文件,解压就是java se的源代码
分享标题:java最全源代码 java开发实例大全源码
标题链接:http://abwzjs.com/article/docdpcc.html