当前位置:首页 » 市场行情 » java设计一个期货价格展示板

java设计一个期货价格展示板

发布时间: 2021-09-14 22:30:17

㈠ 使用JAVA 编写一个程序,显示5中商品价格,用户可以选择多种商品并在其后的文本框输入购买的数量。

听你的意思,有文本框输入,像是html的东西,不是java,代码如下,效果图,




<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Insert title here</title>

</head>

<script type="text/javascript">

function a(){


var a = document.getElementById("apple").value;

document.getElementById("a").innerText=a*5;

}

function b(){

var b = document.getElementById("banana").value;

document.getElementById("b").innerText=b*6;

}

function o(){

var o = document.getElementById("orange").value;

document.getElementById("o").innerText=o*7;

}

function p(){

var p = document.getElementById("potato").value;

document.getElementById("p").innerText=p*8;

}

function f(){

var f = document.getElementById("fish").value;

document.getElementById("f").innerText=f*20;


}

</script>

<body onload="a(),b(),o(),p(),f()">


苹果 :<span>单价:5元</span><input type="text" name="apple" id="apple" onblur="a()" value="1"/><span id="a"></span><br><br>

香蕉 :<span>单价:6元</span><input type="text" name="banana" id="banana" onblur="b()" value="1"/><span id="b"></span><br><br>

橙子 :<span>单价:7元</span><input type="text" name="orange" id="orange" onblur="o()" value="1"/><span id="o"></span><br><br>

西红柿:<span>单价:8元</span><input type="text" name="potato" id="potato" onblur="p()" value="1"/><span id="p"></span><br><br>

鱼 :<span>单价:20元</span><input type="text" name="fish" id="fish" onblur="f()" value="1"/><span id="f"></span><br><br>


</body>

</html>



㈡ 如何通过报表实现如下图所示的一个展示效果(采用Java技术)

可以自己通过Java的画图工具自己画,也可以去找一些开源的图标设计工具。如果是WEb项目的图表可以用JfreeChart或者OpenFlashChart来做

㈢ 求助帖.做个java毕业设计程序大概多少钱

这个一般可能会根据毕设的具体内容来定,包括代码量,复杂度等维度进行度量

㈣ . 设计一个Java程序,其功能是根据商品的价格输出不同的信息:(使用switch – case结

输出一个价格数据
然后通过switch语句在case中的一个区域内比较确定商品的价格再输出

如果不想自己写代码的话支付宝5元可以帮你搞定

㈤ 求java解答,求编写一个题,就是做一个菜单,要求有3个商品,要求输入名字和价格,然后输出出来,输


importjava.io.File;
importjava.io.FileOutputStream;
importjava.io.OutputStream;
importjava.util.Scanner;


publicclassDemo02{
publicstaticvoidmain(String[]args)throwsException{

StringBuffersb=newStringBuffer();
Scannersc=newScanner(System.in);
for(inti=0;i<3;i++){
System.out.print("请输入商品名字: ");
Stringname=sc.nextLine();
System.out.print("请输入商品价格: ");
Stringprice=sc.nextLine();
sb.append("("+name+"/"+price+") ");
}
Filefile=newFile("C:\MyData.txt");
if(!file.exists()){
file.createNewFile();
}
OutputStreamos=newFileOutputStream(file);
byte[]bytes=sb.toString().getBytes();
os.write(bytes,0,bytes.length);
os.close();
sc.close();
}


}

㈥ 用java编写一个小程序 输入书名 价格点击查询按钮 显示厂家 这个代码怎么写

那就看你怎么想了,我给你几个建议,因为我没有时间帮你实现。
建议一:简单实现法:你把每种书名、价格、厂家都作为一个对象的属性分别存到不同的对象中,在主函数中首先用构造方法实例化这几个对象,然后再用你输入的字符串和每个对象的相应属性一一比对,符合条件则输出对应的厂家。
建议二:比较复杂实现法:信息全部保存到数据库,然后再用你输入的字符串和每条记录的相应字段一一比对,符合条件则输出对应的厂家。
如果你对我真诚的回答满意的话,请给我多加分,如果有什么疑问的话,请给我留言。QQ也可以全天在线108424683.

㈦ 商城中商品展示页按价格降序显示怎样用Java实现

你可以在sql中写入两个占位符来代替默认值,然后判断前台有没有传入这个值,如果没有就传入你写好的默认值,如果有传入价格区间值就使用这个传入的值.

㈧ 请设计一个GUI界面,参考如下界面原型实现。求大神用JAVA

importjava.awt.Color;

importjava.awt.event.ActionEvent;

importjava.awt.event.ActionListener;

importjava.util.Random;

importjavax.swing.JButton;

importjavax.swing.JFrame;

importjavax.swing.JPanel;

{

privateJButton[]btns=newJButton[7];

privateRandomrn=newRandom();

privateboolean[]flags=newboolean[33];//用来判别重复

publicMyPanel(){

init();

}

privatevoidinit(){

setTitle("MyPanel....");

setSize(540,250);

setContentPane(createPane());

}

privateJPanelcreatePane(){

JPanelpane=newJPanel(null);

pane.setBackground(Color.YELLOW);

for(inti=0;i<btns.length;i++){

btns[i]=newJButton("0");

btns[i].setBounds(20+(i*70),30,54,24);

btns[i].setBackground(Color.PINK);

pane.add(btns[i]);

btns[i].addActionListener(newActionListener(){

publicvoidactionPerformed(ActionEvente){

while(true){

intn=rn.nextInt(34);

//如果数字被使用,或为3334就重新选数字

if(n==0||n>33||flags[n-1]){

continue;

}

//把使用了的数字设置为true,即已使用

flags[n-1]=true;

//把不用了的数字设置成未使用状态

if(Integer.parseInt(((JButton)e.getSource())

.getText())!=0){

flags[Integer.parseInt(((JButton)e.getSource())

.getText())-1]=false;

}

((JButton)e.getSource()).setText(String.valueOf(n));

break;

}

}

});

}

JButtoncreNum=newJButton("创建数字");

creNum.setBounds(50,150,100,30);

creNum.addActionListener(newActionListener(){

@Override

publicvoidactionPerformed(ActionEvente){

for(inti=0;i<btns.length;i++){

while(true){

intn=rn.nextInt(34);

//如果数字被使用,或为3334就重新选数字

if(n==0||n>33||flags[n-1]){

continue;

}

//把使用了的数字设置为true,即已使用

flags[n-1]=true;

//把不用了的数字设置成未使用状态

if(Integer.parseInt(btns[i].getText())!=0){

flags[Integer.parseInt(btns[i].getText())-1]=false;

}

btns[i].setText(String.valueOf(n));

break;

}

}

}

});

pane.add(creNum);

JButtonsort=newJButton("排序");

sort.setBounds(200,150,100,30);

sort.addActionListener(newActionListener(){

@Override

publicvoidactionPerformed(ActionEvente){

//排序

String[]strs=newString[7];

//把按钮上面的数字拿出来

for(inti=0;i<btns.length;i++){

strs[i]=btns[i].getText();

}

//开始排序

for(inti=strs.length-1;i>0;i--){

for(intj=0;j<i;j++){

if(Integer.parseInt(strs[i])<Integer

.parseInt(strs[j])){

Stringtemp;

temp=strs[i];

strs[i]=strs[j];

strs[j]=temp;

}

}

}

//排好,在显示到按钮上

for(intj=0;j<strs.length;j++){

btns[j].setText(strs[j]);

}

}

});

pane.add(sort);

JButtonreset=newJButton("重置");

reset.setBounds(350,150,100,30);

reset.addActionListener(newActionListener(){

@Override

publicvoidactionPerformed(ActionEvente){

flags=newboolean[33];

for(inti=0;i<btns.length;i++){

btns[i].setText("0");

}

}

});

pane.add(reset);

returnpane;

}

publicstaticvoidmain(String[]args){

MyPanelmp=newMyPanel();

mp.setVisible(true);

}

}

根据你的要求,数字不会重复,用的是冒泡排序

希望对你有帮助

如图:

㈨ 用java设计一个简单的界面设计,越简单越好,谢谢

用java设计一个简单的界面可以参考如下实例:

importjavax.swing.JFrame;//框架
importjavax.swing.JPanel;//面板
importjavax.swing.JButton;//按钮
importjavax.swing.JLabel;//标签
importjavax.swing.JTextField;//文本框
importjava.awt.Font;//字体
importjava.awt.Color;//颜色
importjavax.swing.JPasswordField;//密码框
importjava.awt.event.ActionListener;//事件监听
importjava.awt.event.ActionEvent;//事件处理
importjavax.swing.JOptionPane;//消息窗口{
publicJPanelpnluser;
publicJLabellbluserLogIn;
publicJLabellbluserName;
publicJLabellbluserPWD;
publicJTextFieldtxtName;
publicJPasswordFieldpwdPwd;
publicJButtonbtnSub;
publicJButtonbtnReset;
publicUserLogIn(){
pnluser=newJPanel();
lbluserLogIn=newJLabel();
lbluserName=newJLabel();
lbluserPWD=newJLabel();
txtName=newJTextField();
pwdPwd=newJPasswordField();
btnSub=newJButton();
btnReset=newJButton();
userInit();
}
publicvoiserInit(){
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//设置关闭框架的同时结束程序
this.setSize(300,200);//设置框架大小为长300,宽200
this.setResizable(false);//设置框架不可以改变大小
this.setTitle("用户登录");//设置框架标题
this.pnluser.setLayout(null);//设置面板布局管理
this.pnluser.setBackground(Color.cyan);//设置面板背景颜色
this.lbluserLogIn.setText("用户登录");//设置标签标题
this.lbluserLogIn.setFont(newFont("宋体",Font.BOLD|Font.ITALIC,14));//设置标签字体
this.lbluserLogIn.setForeground(Color.RED);//设置标签字体颜色
this.lbluserName.setText("用户名:");
this.lbluserPWD.setText("密码:");
this.btnSub.setText("登录");
this.btnReset.setText("重置");
this.lbluserLogIn.setBounds(120,15,60,20);//设置标签x坐标120,y坐标15,长60,宽20
this.lbluserName.setBounds(50,55,60,20);
this.lbluserPWD.setBounds(50,85,60,25);
this.txtName.setBounds(110,55,120,20);
this.pwdPwd.setBounds(110,85,120,20);
this.btnSub.setBounds(85,120,60,20);
this.btnSub.addActionListener(newActionListener()//匿名类实现ActionListener接口
{
publicvoidactionPerformed(ActionEvente){
btnsub_ActionEvent(e);
}
}
);
this.btnReset.setBounds(155,120,60,20);
this.btnReset.addActionListener(newActionListener()//匿名类实现ActionListener接口
{
publicvoidactionPerformed(ActionEvente){
btnreset_ActionEvent(e);
}
}
);
this.pnluser.add(lbluserLogIn);//加载标签到面板
this.pnluser.add(lbluserName);
this.pnluser.add(lbluserPWD);
this.pnluser.add(txtName);
this.pnluser.add(pwdPwd);
this.pnluser.add(btnSub);
this.pnluser.add(btnReset);
this.add(pnluser);//加载面板到框架
this.setVisible(true);//设置框架可显
}
publicvoidbtnsub_ActionEvent(ActionEvente){
Stringname=txtName.getText();
Stringpwd=String.valueOf(pwdPwd.getPassword());
if(name.equals("")){
JOptionPane.showMessageDialog(null,"账号不能为空","错误",JOptionPane.ERROR_MESSAGE);
return;
}elseif(pwd.equals("")){
JOptionPane.showMessageDialog(null,"密码不能为空","错误",JOptionPane.ERROR_MESSAGE);
return;
}elseif(true){
this.dispose();
}else{
JOptionPane.showMessageDialog(null,"账号或密码错误","错误",JOptionPane.ERROR_MESSAGE);
return;
}
}
publicvoidbtnreset_ActionEvent(ActionEvente){
txtName.setText("");
pwdPwd.setText("");
}
publicstaticvoidmain(String[]args){
newUserLogIn();
}
}

㈩ java 设计一个Stock的类,这个类包括:

代码如下:

importjava.math.BigDecimal;
importjava.math.RoundingMode;

publicclassStock{
privateStringsymbol;
privateStringname;
;
privatedoublecurrentPrice;

//构造方法
publicStock(Stringsymbol,Stringname){
this.symbol=symbol;
this.name=name;
}

//
publicdoublegetChangePercent(){
return(currentPrice-previousClosingPrice)/previousClosingPrice;
}

(doublepreviousClosingPrice){
this.previousClosingPrice=previousClosingPrice;
}

publicvoidsetCurrentPrice(doublecurrentPrice){
this.currentPrice=currentPrice;
}

publicStringgetSymbol(){
returnsymbol;
}

publicStringgetName(){
returnname;
}

publicstaticvoidmain(String[]args){
Stockstock=newStock("Java","SunMircro");
stock.setCurrentPrice(4.35);//当前价格
stock.setPreviousClosingPrice(4.5);//前一交易日价格
doubled=stock.getChangePercent();//价格浮动:由于是double,下面的计算是N位小数
System.out.println("价格浮动:"+stock.getChangePercent());
//处理下
BigDecimalbd=newBigDecimal(d*100);//乘个100,是为了看效果
bd=bd.setScale(2,RoundingMode.HALF_UP);//设置2位小数,采用四舍五入
System.out.println("["+stock.getSymbol()+"]"+stock.getName()+"价格浮动:"+bd.toString()+"%");
}
}

亲,如果回答满意,亲及时采纳,你的合作是我们回答的动力,谢谢!

热点内容
普洱墨江哈尼族自治县晚籼稻期货开户 发布:2021-12-16 12:35:43 浏览:396
阿坝小金县橡胶期货开户 发布:2021-12-16 12:35:40 浏览:908
楚雄大姚县豆一期货开户 发布:2021-12-16 12:34:02 浏览:736
做期货能在网上开户吗 发布:2021-12-16 12:32:22 浏览:591
安庆宜秀区早籼稻期货开户 发布:2021-12-16 12:32:22 浏览:377
正确的原油期货开户 发布:2021-12-16 12:29:41 浏览:39
达州市纤维板期货开户 发布:2021-12-16 12:25:11 浏览:310
呼伦贝尔新巴尔虎左旗白银期货开户 发布:2021-12-16 12:25:07 浏览:883
上海外盘期货哪里开户 发布:2021-12-16 12:24:10 浏览:448
香港日发期货开户网站 发布:2021-12-16 12:24:09 浏览:780