Compare commits
2 Commits
09810d6449
...
250d8523ec
| Author | SHA1 | Date |
|---|---|---|
|
|
250d8523ec | |
|
|
a4993b02bc |
|
|
@ -0,0 +1,25 @@
|
|||
cmake_minimum_required(VERSION 3.28)
|
||||
project(Drugwars)
|
||||
find_package(Doxygen REQUIRED)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
add_executable(Drugwars src/main.cpp
|
||||
src/Bag.cpp
|
||||
src/Player.cpp
|
||||
src/Bank.cpp
|
||||
|
||||
)
|
||||
target_include_directories(Drugwars PRIVATE src/include)
|
||||
|
||||
if(DOXYGEN_FOUND)
|
||||
set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/docs")
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile ${CMAKE_CURRENT_BINARY_DIR}/docs/Doxyfile @ONLY)
|
||||
|
||||
add_custom_target(doc ALL
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} docs/Doxyfile
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating API documentation with Doxygen"
|
||||
VERBATIM)
|
||||
endif()
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
//
|
||||
// Created by gustavomiranda on 27/09/24.
|
||||
//
|
||||
#include <cmath>
|
||||
#include "Bank.h"
|
||||
|
||||
Bank::Bank(double taxvalue) {
|
||||
setTax(taxvalue);
|
||||
money = 0;
|
||||
}
|
||||
|
||||
void Bank::depositMoney(int value) {
|
||||
money += value;
|
||||
}
|
||||
|
||||
void Bank::withdrawMoney(int value) {
|
||||
if (money >= value){
|
||||
money -= value;
|
||||
}
|
||||
}
|
||||
|
||||
int Bank::getMoney() {
|
||||
return money;
|
||||
}
|
||||
|
||||
void Bank::updateMoney() {
|
||||
money = std::round(money * (1+tax));
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// Created by gustavomiranda on 27/09/24.
|
||||
//
|
||||
|
||||
#ifndef DRUGWARS_BANK_H
|
||||
#define DRUGWARS_BANK_H
|
||||
|
||||
class Bank{
|
||||
private:
|
||||
int money;
|
||||
double tax;
|
||||
void setTax(double value);
|
||||
public:
|
||||
Bank(double taxvalue);
|
||||
void depositMoney(int value);
|
||||
void withdrawMoney(int value);
|
||||
int getMoney();
|
||||
void updateMoney();
|
||||
|
||||
};
|
||||
|
||||
#endif //DRUGWARS_BANK_H
|
||||
Loading…
Reference in New Issue