Class StonkAppMain
Object
StonkAppMain
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) StonkMarket
(package private) StonksAppView
(package private) Wallet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
go()
Main controller for program.static void
void
parseAction
(String action) Parses through user input and performs correlated action.void
purchaseFazCoin
(int numFazCoin) Adds FazCoin to the wallet and removes appropriate USD amountvoid
sellFazCoin
(int numFazCoin) Removes FazCoin from the wallet and adds appropriate USD amountvoid
Initializes the wallet, either default or with custom values based on user input.
-
Field Details
-
sm
StonkMarket sm -
view
StonksAppView view -
w
Wallet w
-
-
Constructor Details
-
StonkAppMain
public StonkAppMain()
-
-
Method Details
-
go
public void go()Main controller for program. -
walletInitializer
public void walletInitializer()Initializes the wallet, either default or with custom values based on user input. -
parseAction
Parses through user input and performs correlated action.- Parameters:
action
- Desired action to be performed by user
-
purchaseFazCoin
public void purchaseFazCoin(int numFazCoin) Adds FazCoin to the wallet and removes appropriate USD amountWhen buying FazCoin:
- Check if there is enough money in your wallet to buy the desired number of FazCoin.
- If you can, then add the purchased FazCoin to your wallet and subtract the cost of the purchased FazCoin from your total USD.
- Otherwise, if the desired amount of FazCoin costs more than you currently have in USD, print a statement such as "You do not have enough money to buy that much FazCoin."
- Parameters:
numFazCoin
- Number of FazCoin you are trying to buy
-
sellFazCoin
public void sellFazCoin(int numFazCoin) Removes FazCoin from the wallet and adds appropriate USD amountWhen selling FazCoin:
- Check if there is enough FazCoin in your wallet to sell the desired number of FazCoin.
- If you can, then subtract the sold FazCoin from your wallet and add the price of the sold FazCoin to your total USD.
- Otherwise, if the desired amount of FazCoin to sell exceeds your current amount of FazCoin, print a statement such as "You do not have enough FazCoin to sell."
- Parameters:
numFazCoin
- Number of FazCoin that you are trying to sell
-
main
-