你是需要這樣的代碼嗎?

10多年專注成都網(wǎng)站制作,成都企業(yè)網(wǎng)站建設(shè),個人網(wǎng)站制作服務(wù),為大家分享網(wǎng)站制作知識、方案,網(wǎng)站設(shè)計流程、步驟,成功服務(wù)上千家企業(yè)。為您提供網(wǎng)站建設(shè),網(wǎng)站制作,網(wǎng)頁設(shè)計及定制高端網(wǎng)站建設(shè)服務(wù),專注于成都企業(yè)網(wǎng)站建設(shè),高端網(wǎng)頁制作,對成都火鍋店設(shè)計等多個領(lǐng)域,擁有多年的網(wǎng)站維護(hù)經(jīng)驗。
你是需要B/S模式的還是C/S模式的?
這些功能寫起來比較簡單,在后臺連個數(shù)據(jù)庫,做些數(shù)據(jù)的處理就可以了。不過要我這沒有現(xiàn)成的,要自己的寫的話估計沒有時間了。如果你是在學(xué)習(xí)java的話,建議你自己動手寫寫,這個小系統(tǒng)能用到好多東西。
簡單點的話直接用JDBC邊數(shù)據(jù)庫,要是好點可以考慮使用Hibernate,如果寫成B/S模式的話,還可以考慮使用一些MVC的框架,struts或者spring,前臺還能使用到ajax.當(dāng)然,你還需要打印報表的功能,這個也是一個難點。
代碼。
你這個代碼很大啊,管理系統(tǒng)。
不知道是javaweb的 ?還是就是java寫的一個圖形界面程序?
給你一個思想。
登陸上選擇不同的身份,提供不同的值,判斷不同的值就可以進(jìn)行不同的顯示效果。
權(quán)限最大的就可以利用 ?type==這個值||type==這個值就可以顯示這個界面。
web 的話就是OGNL語言使用
圖形界面也差不多。
package untitled5;
import java.io.*;
import java.net.*;
import java.sql.*;
import java.lang.*;
import javax.sql.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
public class delbook extends JFrame {
JPanel contentPane;
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JTextField jTextField1 = new JTextField();
JLabel jLabel4 = new JLabel();
JTextField jTextField2 = new JTextField();
JLabel jLabel5 = new JLabel();
JTextField jTextField3 = new JTextField();
JLabel jLabel6 = new JLabel();
JTextField jTextField4 = new JTextField();
JButton jButton1 = new JButton();
//Construct the frame
public delbook() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
contentPane = (JPanel) this.getContentPane();
jLabel1.setFont(new java.awt.Font("SansSerif", 0, 25));
jLabel1.setForeground(Color.red);
jLabel1.setText("超市管理系統(tǒng)");
contentPane.setLayout(xYLayout1);
this.setSize(new Dimension(500,400));
this.setTitle("超市管理系統(tǒng)");
jLabel2.setFont(new java.awt.Font("SansSerif", 0, 30));
jLabel2.setText("業(yè)務(wù)單位信息");
jLabel3.setFont(new java.awt.Font("SansSerif", 0, 25));
jLabel3.setText("產(chǎn)品編號");
jTextField1.setText("");
jLabel4.setFont(new java.awt.Font("SansSerif", 0, 25));
jLabel4.setText("公司名稱");
jTextField2.setText("");
jLabel5.setFont(new java.awt.Font("SansSerif", 0, 25));
jLabel5.setText("訂單號碼");
jTextField3.setText("");
jLabel6.setFont(new java.awt.Font("SansSerif", 0, 25));
jLabel6.setText("電 話");
jTextField4.setText("");
jButton1.setFont(new java.awt.Font("SansSerif", 0, 25));
jButton1.setText("提交");
jButton1.addActionListener(new delbook_jButton1_actionAdapter(this));
contentPane.add(jLabel1, new XYConstraints(179, 1, 153, 32));
contentPane.add(jLabel2, new XYConstraints(162, 33, -1, -1));
contentPane.add(jLabel3, new XYConstraints(83, 89, -1, -1));
contentPane.add(jTextField1, new XYConstraints(189, 88, 141, 36));
contentPane.add(jTextField2, new XYConstraints(189, 149, 142, 36));
contentPane.add(jLabel4, new XYConstraints(84, 148, -1, -1));
contentPane.add(jTextField3, new XYConstraints(188, 206, 143, 33));
contentPane.add(jLabel5, new XYConstraints(84, 204, -1, -1));
contentPane.add(jLabel6, new XYConstraints(84, 253, -1, -1));
contentPane.add(jTextField4, new XYConstraints(189, 260, 143, 36));
contentPane.add(jButton1, new XYConstraints(197, 318, -1, -1));
}
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
void update() {
try {
//定義顯示的字符串
String str1;
String str2;
String str3;
String str4;
str1 = jTextField1.getText();
str2 = jTextField2.getText();
str3 = jTextField3.getText();
str4 = jTextField4.getText();
//裝載jdbc驅(qū)動程序
String driverName = "oracle.jdbc.OracleDriver";
Driver driver = (Driver) Class.forName(driverName).newInstance();
//連接數(shù)據(jù)庫
Connection con = DriverManager.getConnection(
"jdbc:oracle:thin:@thsspc0791:1521:liuyong", "hr", "tongfang");
PreparedStatement pstmt = con.prepareStatement(
" insert Customer1('goodID','Name','PID','tel')values(?,?,?,?)");
pstmt.setString(1, str1);
pstmt.setString(2, str2);
pstmt.setString(1, str3);
pstmt.setString(4, str4);
ResultSet res = pstmt.executeQuery();
pstmt.close();
con.close();
}catch (InstantiationException e) {
System.out.println(e.getMessage());
}catch (IllegalAccessException e) {
System.out.println(e.getMessage());
}catch (ClassNotFoundException e) {
System.out.println(e.getMessage());
}catch (SQLException edd) {
edd.printStackTrace() ;
System.out.println(edd.getMessage());
}
}
void jButton1_actionPerformed(ActionEvent e) {
update();
}
}
class delbook_jButton1_actionAdapter implements java.awt.event.ActionListener {
delbook adaptee;
delbook_jButton1_actionAdapter(delbook adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
package untitled5;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
/**
* pTitle: /p
* pDescription: /p
* pCopyright: Copyright ? 2003/p
* pCompany: /p
* @author not attributable
* @version 1.0
*/
public class retur extends JFrame {
JPanel contentPane;
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel1 = new JLabel();
//Construct the frame
public retur() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
contentPane = (JPanel) this.getContentPane();
jLabel1.setFont(new java.awt.Font("SansSerif", 0, 20));
jLabel1.setForeground(Color.red);
jLabel1.setText("超市管理系統(tǒng)");
contentPane.setLayout(xYLayout1);
this.setSize(new Dimension(400, 300));
this.setTitle("超市管理系統(tǒng)");
contentPane.add(jLabel1, new XYConstraints(139, 1, 126, 33));
}
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
}
package untitled5;
import java.io.*;
import java.net.*;
import java.sql.*;
import java.lang.*;
import javax.sql.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import com.borland.dbswing.*;
//貨品信息登記
public class Frame2 extends JFrame {
JPanel contentPane;
JLabel jLabel1 = new JLabel();
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JTextField jTextField1 = new JTextField();
JLabel jLabel4 = new JLabel();
JTextField jTextField2 = new JTextField();
JPanel jPanel1 = new JPanel();
XYLayout xYLayout2 = new XYLayout();
JScrollPane jScrollPane1 = new JScrollPane();
JLabel jLabel5 = new JLabel();
JTextField jTextField3 = new JTextField();
//Construct the frame
public Frame2() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(xYLayout1);
this.setSize(new Dimension(600, 500));
this.setTitle("超市管理系統(tǒng)");
this.addHierarchyBoundsListener(new Frame2_this_hierarchyBoundsAdapter(this));
jLabel1.setFont(new java.awt.Font("SansSerif", 0, 25));
jLabel1.setForeground(Color.red);
jLabel1.setText("超市管理系統(tǒng)");
contentPane.setForeground(Color.black);
jLabel2.setFont(new java.awt.Font("SansSerif", 0, 30));
jLabel2.setText("產(chǎn) 品 信 息 展 示");
// statusBar.setFont(new java.awt.Font("SansSerif", 0, 20));
jLabel3.setFont(new java.awt.Font("SansSerif", 0, 20));
jLabel3.setText("產(chǎn)品名稱");
jTextField1.setText("");
jLabel4.setEnabled(true);
jLabel4.setFont(new java.awt.Font("SansSerif", 0, 20));
jLabel4.setText("產(chǎn)品ID號");
jTextField2.setText("");
jTextField2.addActionListener(new Frame2_jTextField2_actionAdapter(this));
jPanel1.setLayout(xYLayout2);
jLabel5.setFont(new java.awt.Font("SansSerif", 0, 25));
jLabel5.setForeground(Color.red);
jLabel5.setText("該產(chǎn)品詳細(xì)信息");
jTextField3.setText("");
contentPane.add(jLabel1, new XYConstraints(237, 0, 153, 40));
contentPane.add(jLabel2, new XYConstraints(200, 47, 231, 58));
contentPane.add(jLabel3, new XYConstraints(47, 102, 101, 42));
contentPane.add(jTextField1, new XYConstraints(128, 108, 112, 34));
contentPane.add(jTextField2, new XYConstraints(361, 107, 109, 36));
contentPane.add(jPanel1, new XYConstraints(75, 166, 453, 277));
jPanel1.add(jScrollPane1, new XYConstraints(14, 8, 433, 221));
jScrollPane1.getViewport().add(jTextField3, null);
jPanel1.add(jLabel5, new XYConstraints(112, 240, -1, -1));
contentPane.add(jLabel4, new XYConstraints(278, 111, -1, -1));
}
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
void Select() {
try {
String str1, str2;
str1 = jTextField1.getText();
str2 = jTextField2.getText();
你好 具體實現(xiàn)如下:
#includestdio.h
#includestring.h
#includestdlib.h
#define w 1.8/*水1.8元/噸*/
#define e 0.5/*電0.5元/度*/
struct user{
char name[10],ID[20];/*用戶的姓名和身份證號碼*/
double water,electricity;/*用水(噸)、電(度)量*/
double monney;/*總共的水電費用*/
}u[100];/*用戶最大容量為100*/
/*顯示用戶信息*/
void display(){
int n;/*確定當(dāng)前用戶的人數(shù)*/
int i;
for(n=0;n100;n++)
if(u[n].monney==0) break;
if(n==0)
printf("系統(tǒng)無用戶,需要添加!^_^\n");
else
for(i=0;in;i++)
printf("\n編號:%d\t姓名:%s\tID:%s\t用水量:%.1f噸\t用電量:%.1f度\n",i+1,u[i].name,u[i].ID,u[i].water,u[i].electricity);
}
/*添加用戶*/
void add(){
int n;/*確定當(dāng)前用戶的人數(shù)*/
for(n=0;n100;n++)
if(u[n].monney==0) break;
printf("\t\t\t請輸入新用戶的姓名:");
scanf("%s",u[n].name);
printf("\t\t\t請輸入新用戶的ID(18位):");
scanf("%s",u[n].ID);
printf("\t\t\t請輸入新用戶的用水量:");
scanf("%lf",u[n].water);
printf("\t\t\t請輸入新用戶的用電量:");
scanf("%lf",u[n].electricity);
u[n].monney=(u[n].water)*w+(u[n].electricity)*e;
printf("\n添加成功!\n");
}
/*修改用戶信息*/
void alter(){
char name[10];
int n;/*確定當(dāng)前用戶的人數(shù)*/
int i;
printf("\t\t\t請輸入您的姓名:");
scanf("%s",name);
for(n=0;n100;n++)
if(u[n].monney==0) break;
for(i=0;in;i++)
if(strcmp(u[i].name,name)==0){
int choice=0;
printf("\n\t\t\t1.修改ID\n\t\t\t2.修改用水量\n\t\t\t3.修改用電量\n\t\t\t4.退出\n");
printf("\n\t\t\t請輸入您的選擇:");
GOTO1:scanf("%d",choice);
switch(choice)
{
case 1:
printf("\n\t\t\t請輸入ID:");
scanf("%s",u[i].ID);
break;
case 2:
printf("\n\t\t\t請輸入用水量:");
scanf("%lf",u[i].water);
break;
case 3:
printf("\n\t\t\t請輸入用電量:");
scanf("%lf",u[i].electricity);
break;
case 4:
break;
default:
printf("\t\t\t輸入錯誤,請重新輸入:");
goto GOTO1;
}
printf("\n修改成功!\n");
break;
}
if(i==n)
printf("\n\t\t\t沒有此用戶,您可以選擇注冊新用戶^_^!\n");
}
/*刪除用戶*/
void delete_(){
int n,i=0,j;
for(n=0;n100;n++)
if(u[n].monney==0) break;
display();
printf("\n\t\t\t請輸入要刪除用戶對應(yīng)的編號:");
scanf("%d",i);
for(j=i-1;jn;j++){
strcpy(u[j].name,u[j+1].name);
u[j].electricity=u[j+1].electricity;
strcpy(u[j].ID,u[j+1].ID);
u[j].monney=u[j+1].monney;
u[j].water=u[j+1].water;
}
u[n-1].monney=0;
printf("刪除成功!^_^\n");
}
/*用戶管理*/
void m_user(){
int choice=0;
GOTO2:system("cls");
printf("\t\t\t---------------------\n");
printf("\t\t\t| 用戶管理^_^ |\n");
printf("\t\t\t---------------------\n\n\n");
printf("\n\t\t\t1.顯示用戶信息\n\t\t\t2.添加用戶\n\t\t\t3.修改用戶信息\n\t\t\t4.刪除用戶信息\n\t\t\t5.退出");
printf("\n\t\t\t請輸入您的選擇:");
GOTO3:scanf("%d",choice);
switch(choice)
{
case 1:
display();
system("pause");
goto GOTO2;
case 2:
add();
system("pause");
goto GOTO2;
case 3:
alter();
system("pause");;
goto GOTO2;
case 4:
delete_();
system("pause");;
goto GOTO2;
case 5:
break;
default:
printf("\t\t\t輸入有誤,請重新輸入:");
goto GOTO3;
}
}
/*收費管理*/
void m_fee(){
int n,i,choice=0;
double w_sum=0,e_sum=0;
GOTO4:system("cls");
printf("\t\t\t---------------------\n");
printf("\t\t\t| 收費管理^_^ |\n");
printf("\t\t\t---------------------\n\n\n");
for(n=0;n100;n++)
if(u[n].monney==0) break;
printf("\n\t\t\t1.用戶費用信息查詢\n\t\t\t2.總水費\n\t\t\t3.總電費\n\t\t\t4.總費用\n\t\t\t5.退出\n");
printf("\n\t\t\t請輸入您的選擇:");
GOTO5:scanf("%d",choice);
switch(choice)
{
case 1:
if(n==00)
printf("\n\t\t\t系統(tǒng)無注冊用戶!\n");
else
for(i=0;in;i++){
printf("\n\t姓名:%s\t水費:%.2f元\t電費:%.2f元\t繳納的總費用:%.2f元\n",u[i].name,(u[i].water)*w,(u[i].electricity)*e,u[i].monney);
w_sum+=u[i].water*w;
e_sum+=u[i].electricity*e;
}
system("pause");
goto GOTO4;
case 2:
printf("\n\t\t\t系統(tǒng)用戶繳納的總水費:%.2f元\n",w_sum);
system("pause");
goto GOTO4;
case 3:
printf("\n\t\t\t系統(tǒng)用戶繳納的總電費:%.2f元\n",e_sum);
system("pause");
goto GOTO4;
case 4:
printf("\n\t\t\t系統(tǒng)用戶繳納的總費用:%.2f元\n",w_sum+e_sum);
system("pause");
goto GOTO4;
case 5:
printf("管理完畢!\n");
break;
default:
printf("\n\t\t\t輸入錯誤,請重新輸入:");
goto GOTO5;
}
}
void main(){
int choice=0;
GOTO6:system("cls");
printf("\t\t\t-----------------------------------\n");
printf("\t\t\t| 歡迎進(jìn)入水電費管理系統(tǒng)^_^ |\n");
printf("\t\t\t-----------------------------------\n\n\n");
printf("\n\t\t\t1.用戶管理\n\t\t\t2.收費管理\n\t\t\t3.退出\n");
printf("\n\t\t\t請輸入您的選擇:");
GOTO7:scanf("%d",choice);
switch(choice)
{
case 1:
m_user();
system("pause");
goto GOTO6;
case 2:
m_fee();
system("pause");
goto GOTO6;
case 3:
break;
default:
printf("\n您的輸入有誤,請重新輸入:");
goto GOTO7;
}
}
共享了 希望能幫助更多人
package?c;
import?java.util.Scanner;
public?class?SuperMarket?{
static?Scanner?scan?=?new?Scanner(System.in);
public?static?String?str;
public?static?void?main(String[]?args)?{
showMsg();
while?(scan.hasNext())?{
switch?(scan.nextInt())?{
case?1:
commodityManage();
break;
case?2:
customerManage();
break;
case?3:
orderManage();
break;
case?4:
exitSystem();
break;
default:
System.out.println("輸入錯誤,請重新輸入!");
break;
}
}
scan.close();
}
/**
?*?顯示信息
?*/
public?static?void?showMsg()?{
System.out.println("===================================");
System.out.println("\t超??市??庫??存??管??理??系??統(tǒng)\t");
System.out.println("===================================");
System.out.println("1、商品管理");
System.out.println("2、客戶管理");
System.out.println("3、訂單管理");
System.out.println("4、退出系統(tǒng)");
System.out.println("===================================");
System.out.println("請輸入您的選擇(1-4):");
}
/**
?*?選項?1、商品管理
?*/
public?static?void?commodityManage()?{
str?=?"商品管理";
showWelcom(str);
System.out.println("以上為商品管理的信息!\n是否繼續(xù)?(按1繼續(xù)/其他結(jié)束):");
exitOrShow(1);
}
/**
?*?選項?2、客戶管理
?*/
public?static?void?customerManage()?{
str?=?"客戶管理";
System.out.println("以上為客戶管理的信息!\n是否繼續(xù)?(按2繼續(xù)/其他結(jié)束):");
exitOrShow(2);
}
/**
?*?選項?3、訂單管理
?*/
public?static?void?orderManage()?{
str?=?"訂單管理";
System.out.println("以上為訂單管理的信息!\n是否繼續(xù)?(按3繼續(xù)/其他結(jié)束):");
exitOrShow(3);
}
/**
?*?選項?4、退出系統(tǒng)
?*/
public?static?void?exitSystem()?{
System.exit(0);
}
public?static?void?showWelcom(String?str)?{
System.out.println("歡迎進(jìn)入"+?str?+"模塊");
System.out.println("===================================");
}
public?static?void?exitOrShow(int?nextInt)?{
if?(scan.nextInt()?!=?nextInt)?{
exitSystem();
}?else?{
showMsg();
}
}
}
新聞名稱:java水費管理系統(tǒng)代碼 水費收繳系統(tǒng)源碼
網(wǎng)站網(wǎng)址:http://www.yijiale78.com/article32/hhchsc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供建站公司、網(wǎng)站建設(shè)、做網(wǎng)站、App開發(fā)、品牌網(wǎng)站制作、網(wǎng)站設(shè)計
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)