java高级程序代码 java高级编程题库和答案

求一个java程序代码

package Test1;

创新互联建站专注于企业全网整合营销推广、网站重做改版、延长网站定制设计、自适应品牌网站建设、H5开发商城网站制作、集团公司官网建设、外贸营销网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为延长等各大城市提供网站开发制作服务。

import java.time.LocalDateTime;

import java.time.Month;

import java.util.IntSummaryStatistics;

import java.util.Scanner;

import java.util.Vector;

public class D {

static String s1 = "";

public static void main(String[] args) {

int day = LocalDateTime.now().getDayOfMonth();

Month month = LocalDateTime.now().getMonth();

int i = 1, i1 = 0;

VectorInteger vector=new Vector();

Scanner scanner = new Scanner(System.in);

while (i day + 1) {

System.out.println("请输入" + month + "月" + i + "日走的步数");

try {

i1 = scanner.nextInt();

} catch (Exception e) {

// TODO: handle exception

System.out.println("输入错误,请重新输入");

continue;

}

vector.add(i1);

i++;

}

scanner.close();

IntSummaryStatistics intSummaryStatistics=vector.stream().mapToInt(x-x).summaryStatistics();

int i2=intSummaryStatistics.getMax();

int i3=vector.indexOf(i2);

System.out.println(month+"月走的步数最多的日期为: "+(i3+1)+"号");

System.out.println("最多的步数为: "+i2);

}

}

一段JAVA程序代码

多了个分号,修改好的程序:

import java.awt.*;

import javax.swing.*;

import javax.swing.event.*;

import javax.swing.colorchooser.*;

public class Hp extends JFrame {

private static final long serialVersionUID = 1L;

DefaultColorSelectionModel model = new DefaultColorSelectionModel();

JColorChooser colorchooser = new JColorChooser(model);

JLabel label1 = new JLabel("请选择颜色来改变背景色");

Font font = new Font("Serif", Font.ITALIC | Font.BOLD, 40);

GridBagConstraints gcons = new GridBagConstraints();

Color color;

public static void main(String[] args) {

Hp frame1 = new Hp();

frame1.setTitle("JColorChooser 调色板");

frame1.setSize(500, 500);

frame1.setVisible(true);

}

public Hp() {

label1.setFont(font);

getContentPane().setLayout(new GridBagLayout());

gcons.weighty = 1;

gcons.gridwidth = GridBagConstraints.REMAINDER;

getContentPane().add(label1, gcons);

gcons.weighty = 2;

getContentPane().add(colorchooser, gcons);

model.addChangeListener(new ChangeLis());

}

class ChangeLis implements ChangeListener {

public void stateChanged(ChangeEvent e)

{

color = colorchooser.getColor();

getContentPane().setBackground(color);

}

}

}

求一Java程序代码!!

public class Matriculate {

private int score=400;

public int isMatriculate(Student stu){

if (stu.getIntgretResult()=score||(stu.getIntgretResult()=300stu.getSports()=90)) {

return 1;

}else {

return 0;

}

}

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

Student stu1=new Student("zhangsan",1);

stu1.setIntgretResult(400);

Student stu2=new Student("lisi",2);

stu2.setSports(85);

stu2.setIntgretResult(356);

Matriculate m=new Matriculate();

int c1=m.isMatriculate(stu1);

if (c10) {

System.out.println("id:"+stu1.getId()+"\tname:"+stu1.getName()

+"\tIntgretResult:"+stu1.getIntgretResult()+"\tsports"+stu1.getSports());

System.out.println("被录取");

}

int c2=m.isMatriculate(stu2);

if (c20) {

System.out.println("id:"+stu2.getId()+"\tname:"+stu2.getName()

+"\tIntgretResult:"+stu2.getIntgretResult()+"\tsports"+stu2.getSports());

System.out.println("被录取");

}

}

}

class School{

public School(){}

public School(String schoolname, double scoreLine) {

this.schoolname = schoolname;

this.scoreLine = scoreLine;

}

private String schoolname;

private double scoreLine;

public String getSchoolname() {

return schoolname;

}

public double getScoreLine() {

return scoreLine;

}

}

class Student{

public Student(){}

public Student(String name, int id) {

this.name = name;

this.id = id;

}

private String name;

private int id;

private double intgretResult;

private int sports;

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public int getId() {

return id;

}

public void setId(int id) {

this.id = id;

}

public double getIntgretResult() {

return intgretResult;

}

public void setIntgretResult(double intgretResult) {

this.intgretResult = intgretResult;

}

public int getSports() {

return sports;

}

public void setSports(int sports) {

this.sports = sports;

}

}


新闻标题:java高级程序代码 java高级编程题库和答案
文章转载:http://scyanting.com/article/dosphoj.html