GithubHelp home page GithubHelp logo

2042groupproject's Introduction

Using complier: https://replit.com/@replitfaris/CPlusPlus20#main.cpp (addition: click "fork and run" in order to start editing) Include library:

#include <algorithm> #include <chrono> #include <iostream> #include <list> #include <map> #include <string> #include <vector> #include <climits> #include <stdio.h> #include <string.h>

2042groupproject's People

Contributors

terencekam avatar crich7rd avatar royroylh avatar gary16161 avatar

Watchers

 avatar

2042groupproject's Issues

Overflow error

It seems that the overflow error would occur while user is editing the CC Point, here is an example:

image

I guess that the change of the CC Point should be done after if condition, and the CC point may be defined as unsigned variable.

Could add a list title of the function 2?

compiler: c++ shell (version: c++20)
螢幕擷取畫面 2024-04-21 184459

Since the list which listed by function 2 do not have a title, may you add the title of the lists?

Besides, it seems that the list presents the rank of customers with (0,1,2) but not (G,S,B), is it correct?

alphabetical order

The new record is not in alphabetical order after adding new customer
Tommy2015 should below TigerMan
Screenshot 2024-04-25 at 6 26 21 PM

Extreme example of R4

While the money amount is too large, the CC point will go into the negative side, just like:
螢幕擷取畫面 2024-04-22 225727

advise: should use unsigned for defining the variable.

debug

  1. show record --->table output sort -->t and m not sort correc5
  2. edit customer --->input id -->range (input 61 char)--> error .
  3. . edit customer --->input id -->is on list -----> add customer------>yes----->day input---->correct day -----(today, year(2024 eg 29042004 , 31012024))
  4. edit customer --->input id -->is on list -----> add customer------>yes----->day input---->wrong day
  5. edit customer --->input id -->is on list -----> add customer------>yes----->day input---->correct day ---->point --->no return menu's error , input type error (no return menu eg. we input 'a' )

bug

line 323
螢幕截圖 2024-04-22 下午2 37 59
no need too cout Please input CustomerID: twice

extra money neeeded(?)

Screenshot 2024-04-25 at 6 53 10 PM Should the extra money needed be 2400 - (8500 * 0.2 ) = 2400 - 1700 = 700 the discount should only worked on points required, when points required * discount < the point balance , then extra money is needed. or maybe my calculations are wrong

Input date error and suggestion

image
input "1223".
Suggestion:
image
If there is more than three times situation, output back to main menu. Below one is suggest code.

Suggestion for output information

image
For line 452, it may be better to change to "Input a amount of money: "
image
For line 770 to line 775, it may be better if we add '\n' or endl.

Changes for case 2 in main page (function R2)

In the class customerlist, void tostring() would be like:
void toString() {
printf("%-15s %-s %10d\n",CustomerID.c_str(), RanktoString[Ranking].c_str() , PointBalance);
}

In the struct giftrecord, void tostring would be like:
void toString(){
printf("%-6s %-10d %-6d %s\n",GiftID , price , PointRequired , GiftDiscription);
}

Besides, in the main(), it would be changed as:
case 2: {
sort(giftRecordList.begin() , giftRecordList.end() , []( GiftRecord a , GiftRecord b){
if (tolower(*a.GiftID) > tolower(*b.GiftID)) {
return false;
}
return true;
});
sort(customerList.begin() , customerList.end() , [](Customer a , Customer b){
if (tolower(*a.getCustomerID().c_str()) > tolower(*b.getCustomerID().c_str())) {
return false;
}
return true;
});
printf("%-15s %-6s %-s\n", "Customer ID", "Rank", "Point Balance");
for (auto customer_list : customerList) {
customer_list.toString();
}
printf("%-5s %-7s %-9s %s\n", "GiftID", "Price(HKD)", "Points Required", "Gift Description");
for (auto giftRecord : giftRecordList) {
giftRecord.toString();
}
break;
}

class of R5

here is the class of R5:

class CC_changehistory { //create class F5
public:
void createaddCC(string a, float b, int c, int d) {
user = a;
spent_money = b;
CC_point_ori = c;
CC_point_new = d;
}//constructor of F4.1

void createGift(string a, string b, char& c, int d, int e, float f) {
    user = a;
    description = b;
    giftrecording5 = &c;
    CC_point_ori = d;
    CC_point_new = e;
    extra_spent = f;
}//constructor of F4.2

void createchangeCC(string a, int b, int c) {
    user = a;
    CC_point_ori = b;
    CC_point_new = c;
}//constructor of F4.3

string getName() {
    return user;
} //return customerID

int getOrg() {
    return CC_point_ori;
}

int getLast() {
    return CC_point_new;
}

float getSpent() {
    return spent_money;
}

float getExtra() {
    return extra_spent;
}

char getGift() {
    return *giftrecording5;
}

void printF41() {
    int w = 10;
    cout << setw(w) << "Spent Money:" << setw(w) << spent_money << endl;
    cout << setw(w) << "Value change:" << setw(w) << CC_point_ori - CC_point_new << endl;
}//Output of F4.1 in F5

void printF42() {
    int w = 10;
    cout << setw(w) << "Chosen gift:" << setw(w) << *giftrecording5 << endl;
    cout << setw(w) << "Gift detail:" << setw(w) << description << endl;
    cout << setw(w) << "CC point spent:" << setw(w) << CC_point_new - CC_point_ori << endl;
    cout << setw(w) << "Extra spend:" << setw(w) << extra_spent << endl;
}//Output of F4.2 in F5

void printF43() {
    int w = 10;
    if (CC_point_new > CC_point_ori) {
        cout << setw(w) << "Type of change:" << setw(w) << "incresaing.\n";
        cout << setw(w) << "Increase value:" << setw(w) << CC_point_new - CC_point_ori << endl;
    }
    else if (CC_point_new < CC_point_ori) {
        cout << setw(w) << "Type of change:" << setw(w) << "decresaing.\n";
        cout << setw(w) << "Dncrease value:" << setw(w) << CC_point_ori - CC_point_new << endl;
    }
} //Output of F4.3 in F5

private:
string user; //dumb guy of F4
string description; //chosen gift descri of F4.2
char* giftrecording5 = new char[3]; //chosen gift of F4.2
int CC_point_ori; //point balance before running the F4(1/2/3)
int CC_point_new; //point balance after running the F4(1/2/3)
float spent_money; //spent input in F4.1
float extra_spent; //spent input in F4.2
};

vector<CC_changehistory> Fun5; //build up vector of class CC_changehistory
CC_changehistory F5; //name an object of CC_changehistory

Suggestion: Delete some unnecessary functions

Seems that the void warn(string log) and void error (string log) in class Logger do not use in any place in the current program, I suggest deleting them and delete the enum level and map<level, string> as well.

螢幕擷取畫面 2024-04-26 132805

螢幕擷取畫面 2024-04-26 132815

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.