「java收银程序」java做收银系统

博主:adminadmin 2023-03-17 05:27:07 515

本篇文章给大家谈谈java收银程序,以及java做收银系统对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

跪求JAVA高手帮忙编一个程序!急急急,非常感谢呀~

public class Complex {

private int entry;//实部

private int visual;//虚部

public Complex() {

super();

}

public Complex(int en, int vi) {

super();

this.setEntry(en);

this.setVisual(vi);

}

public int getEntry() {

return entry;

}

public void setEntry(int entry) {

this.entry = entry;

}

public int getVisual() {

return visual;

}

public void setVisual(int visual) {

this.visual = visual;

}

//显示:

public void showComp(){

System.out.println(this.getEntry()+"+"+this.getVisual()+"i");

}

//加法:

public Complex addComp(Complex c1,Complex c2){

int e = c1.entry + c2.entry;

int v = c1.visual + c2.visual;

Complex c = new Complex(e,v);

return c;

}

//减法:

public Complex subComp(Complex c1,Complex c2){

int e = c1.entry - c2.entry;

int v = c1.visual - c2.visual;

Complex c = new Complex(e,v);

return c;

}

//乘法:

public Complex multiComp(Complex c1,Complex c2){

int e = c1.entry*c2.entry - c1.visual*c2.visual;

int v = c1.visual*c2.entry + c1.entry*c2.visual;

Complex c = new Complex(e,v);

return c;

}

//相同返回true,不同返回false

public boolean equalComp(Complex c1,Complex c2){

return c1.entry==c2.entry c1.visual == c2.visual;

}

}

//测试类

public class Test {

public static void main(String [] args){

//验证默认构造初始化:实部是0,虚部也是0

Complex c = new Complex();

System.out.print("默认构造结果是:");

System.out.println(c.getEntry());

System.out.println(c.getVisual());

//加法:

Complex c1 = new Complex(3,7);

Complex c2 = new Complex(5,6);

Complex cj = new Complex();

cj = c.addComp(c1,c2);

System.out.print("加法结果是:");

cj.showComp();

//减法:

Complex c3 = new Complex();

Complex c4 = new Complex();

Complex cm = new Complex();

cm = c.subComp(c1,c2);

System.out.print("减法结果是:");

cm.showComp();

//乘法:

Complex c5 = new Complex();

Complex c6 = new Complex();

Complex cc = new Complex();

cc = c.multiComp(c1,c2);

System.out.print("乘法结果是:");

cc.showComp();

//相等比较:

Complex c7 = new Complex(3,-3);

Complex c8 = new Complex(3,4);

Complex c9 = new Complex(3,4);

boolean resuls1 = c.equalComp(c7,c8);

boolean resuls2 = c.equalComp(c8,c9);

System.out.print("比较结果是:");

System.out.print(resuls1?true:false);

System.out.print(resuls2?true:false);

}

}

Java项目中,酒店管理系统中收银模块的收银部分用什么技术去实现

这个没什么特别的技术吧,看你的需求,如果强调数据准确性可以加数据库锁或者是程序锁

用java程序在以下的题目列表中任意选择一题完成:

2、 考试时间的倒计时

a) 在界面显示2个小时的考试时间倒计时(使用线程)

b) 并可以实现倒计时的暂停和继续

package pojo;

import java.awt.*;

import java.util.*;

import java.awt.event.*;

import javax.swing.*;

public class TestClock {

/**

* @param args

*/

public static void main(String[] args) {

// TODO Auto-generated method stub

new Clock();

}

}

class Clock extends JFrame implements ActionListener {

//private Clocker c = new Clocker();

private JLabel label = new JLabel();

private Button button1=new Button("继续");

private Button button2=new Button("停止");

private boolean isStart = false;

private static Date date = new Date(7200000*9+1000);

public Clock (){

super("电子时钟");

this.setLocation(300,300);

this.setSize(100,150);

this.setBackground(Color.black);

this.setDefaultCloseOperation(EXIT_ON_CLOSE);

label.setFont(new Font("Dialog", Font.BOLD, 30));

setLabel();

this.add(label,BorderLayout.NORTH);

Panel p1= new Panel();

p1.add(button1);

p1.add(button2);

button1.addActionListener(this);

button2.addActionListener(this);

this.add(p1,BorderLayout.SOUTH);

this.setVisible(true);

this.setResizable(false);

this.pack();

}

private Date subTime(){

long l = 1000;

this.date.setTime(date.getTime()-l);

return date;

}

public void setLabel(){

Date d = subTime();

String strTime = String.format("%tT",d);

label.setText(strTime);

}

public void actionPerformed(ActionEvent e) {

Clocker c = new Clocker();

String current = e.getActionCommand();

if (current == "继续") {

c.starts();

}

if (current == "停止") c.stops();

}

class Clocker extends Thread{

public void run(){

while(isStart) {

setLabel();

try {

Thread.sleep(1000);

} catch(Exception e) {

e.printStackTrace();

}

}

}

public void starts(){

isStart = true;

this.start();

}

public void stops (){

isStart = false;

}

}

}

Java 超市收银系统

用eclipse的可视化插件或者netbeans可视化做吧,简单的很快。

仅供参考~

java收银程序的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java做收银系统、java收银程序的信息别忘了在本站进行查找喔。