知方号

知方号

个人财务管理系统<个人财务表包括>

个人财务管理系统

目标要求:

一、系统功能简介:个人财务收支管理系统可以将日常收入、支出流水保存起来,随时更新、查询收支记录及收支平衡情况。 二、课程设计要求: 1、采用面向对象的方法进行系统分析与设计,利用 UML 类图绘制分析设计结果。 2、按照时间顺序保存收支记录,所有收支记录保存在磁盘文件当中,系统开始运行时从 磁盘读取数据,退出系统时自动将所有数据写入磁盘文件。 3、系统对用户录入的数据具有一定的容错能力,例如,输入的日期为 2023 年 2 月 29 日, 提醒用户重新录入时间。 4、系统有自动提醒功能:当实时收支平衡数额为负数时,发出超支警示;当实时收支平 衡数额达到预期目标时,提示实现财务自由。 5、系统主菜单样例: 1-添加收入记录 2-添加支出记录 3-查看起止日期内的收入记录 4-查看起止日期内的支出记录 5-查看实时收支平衡情况 6-按照日期查找收支记录 7-按照日期修改收支记录 8-按照日期删除收支记录 9-统计起止日期内的各类别收支情况 0-退出系统

程序设计思路

定义三个类,分别命名为Date,Fee,Manager,Date类里面含有年月日成员变量以及重载的判断时间的>、} int getyear() { return year; } int getmonth() { return month; } int getday() { return day; } bool operator == (Date b) { if (year == b.year && month == b.month && day == b.day) return true; else return false; } bool operator //同年 if (month > a.month) return false; else if (month //同年 if (month > a.month) return false; else if (month //同年 if (month a.month) return true; else //同月 return day >= a.day; } }};

Fee.h

#pragma once#pragma once#include#include"Date.h"using namespace std;class Fee {public:Fee(double amount, int type, Date date) :amount(amount), type(type), date(date) { };Date getdate() {return date;}int gettype() {return type;}double getamount() {return amount;}void showdate() {cout }void addIrecord(vector income, double balance);void addErecord(vector expense, double balance);void checkIrecord(vectorincome);void checkErecord(vectorexpense);void judgeamount(vectorincome, vectorexpense, double target);void showstatistics(vector income, vector expense);void searchrecord(vector income, vector expense);void editrecord(vector income, vector expense);void deleterecord(vector income, vector expense);void settarget();double getbalance() {return balance;}double gettarget() {return target;}private:vector income;vector expense;double balance;double target;};

Manager.cpp

#include#include"Manager.h"#include#include"Date.h"#include"Fee.h"#include#include#includeusing namespace std;bool judge(int year, int month, int day) {SYSTEMTIME st;GetLocalTime(&st);if (year > st.wYear || year if (month > st.wMonth || month if (day > st.wDay || day cout cout cout if (day > 29 || day if (day > 28 || day return fee1.getdate() os if (date == it->getdate()) {switch (it->gettype()) {case 1:cout if (date == it->getdate()) {switch (it->gettype()) {case 1:cout cout target;}this->target = target;}void Manager::addIrecord(vector income, double balance) {int temp;int adate[3];double a;bool flag = false;addI1:cout cout int temp;int adate[3];double a;bool flag = false;addE1:cout cout cout balance -= fee->getamount();}getbalance();cout.precision(18);cout int datebegin[3], datend[3];bool flag1 = false;bool flag2 = false;while (1){cout cout datend[0] >> datend[1] >> datend[2];flag2 = judge(datend[0], datend[1], datend[2]);}if (datebegin[0] > datend[0]) {flag1 = false;flag2 = false;cout flag1 = false;flag2 = false;cout flag1 = false;flag2 = false;cout sum += it->getamount();switch (it->gettype()) {case 1:cout int datebegin[3], datend[3];bool flag1 = false;bool flag2 = false;while (1){cout cout datend[0] >> datend[1] >> datend[2];flag2 = judge(datend[0], datend[1], datend[2]);}if (datebegin[0] > datend[0]) {flag1 = false;flag2 = false;cout flag1 = false;flag2 = false;cout flag1 = false;flag2 = false;cout sum += it->getamount();switch (it->gettype()) {case 1:cout int Sdate[3];bool flag = false;while (flag == false) {cout Sdate[0] >> Sdate[1] >> Sdate[2];flag = judge(Sdate[0], Sdate[1], Sdate[2]);}Date date(Sdate[0], Sdate[1], Sdate[2]);cout cout Ddate[1] >> Ddate[2];flag = judge(Ddate[0], Ddate[1], Ddate[2]);}Date date(Ddate[0], Ddate[1], Ddate[2]);cout cout cout it = income.erase(it);reserve(income, "Idata.txt");flag = true;//防止多删break;}}if (flag == false) {cout cout it = expense.erase(it);reserve(expense, "Edata.txt");flag = true;//防止多删break;}}if (flag == false) {cout cout cout Edate[0] >> Edate[1] >> Edate[2];flag = judge(Edate[0], Edate[1], Edate[2]);}Date date(Edate[0], Edate[1], Edate[2]);cout cout cout editI1:cout cout Type2:cout if (date == it->getdate() && type == it->gettype() && amount == it->getamount()) {editE1:cout cout cout int startDate[3];int endDate[3];bool flag1 = false;bool flag2 = false;while (1){cout cout endDate[0] >> endDate[1] >> endDate[2];flag2 = judge(endDate[0], endDate[1], endDate[2]);}if (startDate[0] > endDate[0]) {flag1 = false;flag2 = false;cout flag1 = false;flag2 = false;cout flag1 = false;flag2 = false;cout i.showdate();cout j.showdate();cout i.showdate();cout j.showdate();cout i.showdate();cout j.showdate();cout i.showdate();cout j.showdate();cout i.showdate();cout j.showdate();cout ifstream in("Idata.txt"); //txt文件与源代码要在一个文件夹内 string line; int type; int y, m, d; double amount; double balance = 0; double target = 0; vector income; if (in) // 有该文件 { while (getline(in, line)) //从文件中逐行读取 { istringstream strStream(line); strStream >> type; strStream >> y >> m >> d; Date date(y, m, d); strStream >> amount; Fee fee(amount, type, date); income.push_back(fee); } } else // 没有该文件 { cout istringstream strStream(Line); strStream >> Type; strStream >> Y >> M >> D; Date date(Y, M, D); strStream >> Amount; Fee fee(Amount, Type, date); expense.push_back(fee); } } else // 没有该文件 { cout

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至lizi9903@foxmail.com举报,一经查实,本站将立刻删除。

上一篇 没有了

下一篇没有了