Question
Make a baby bitcoin program that lets us keep track of buying and selling bitcoin with a menu. The program will keep track of how
Make a baby bitcoin program that lets us keep track of buying and selling bitcoin with a menu. The program will keep track of how many imaginary bitcoins we have. We are going to assume that you each have $20,000 to invest. For this project, we assume you only are going to be dealing with one currency: bitcoin (BTC). Design a text-based menu or a string-based menu. the detail showing below:
1.The user can ask for the current value of bitcoin (just use a default value initially of 25000k, once you get that working change it so that Get Live value class generates a random price/range to simulate current market fluctuations).
2.They can buy bitcoin.
Would buy you half a bitcoin or 3k or 30k. Make sure they have enough money to buy what they want to buy. Another acceptable way you could do this would be to have them say
3. They can sell bitcoin.
Would sell half a bitcoin or 3k or 30k. Make sure they have enough bitcoin in their wallet to sell what they want to sell. Another option would be to have them say
4. They can print their balance (show their current USD, the number of bitcoins they have, and USD value of the bitcoins they have)
5. They can print the history of their buy and sell transactions out. This should have the time, which you can format however you want ie: bought 1 bitcoin on September 12, 2019.
There are functions available to get the current date and time. We will be using rand/random to generate a (fake) live value of bitcoin. Initially, you can just use 25000 as the value when you first get started. We will use an array list (Java) or vectors (C+) or list or dictionary (Python) to store the command history
Lets say that you buy 1.5 bitcoin on September 15th at a market price of $10,000 per coin. Your cash balance would go down from 20K to 5K and the bitcoins in your wallet would go from none, up to 1.5. If you sold half a bitcoin for 6K dollars, your cash balance would go up to 11,000 and your number of bitcoins go down to 1.0.
6. Make a Class called Wallet
We need a class to store our imaginary coins in. Well, we can declare our own class, called Wallet, to help us get something done for this project. Our wallet class is going to help us store our information on a single cryptocurrency.
1) We need to store the ticker symbol for the coin 2) We need to store how many coins we currently have 3) We also need a print method in the class that will print the information out. So, this method will print out the ticker symbol (BTC) for the coin and the number of coins currently in the wallet.
7.Make a Class called Ledger
We need a class that is going to turn our transactions into a string and store them for our history.
1) It will store the transaction strings just so we have a record of the buy-sell commands 2) It will be able to print out the transaction history if requested
We are going to use ArrayList(Java) Vectors(C++) List or Dict (Python) for this.
8.Make a Class called MyDate
This class will call the library routines to get the current date. It will have a function in it that returns that date as a string. We need this for our transaction history
9.Make a Class called GetLive
This is going to fetch the current live value of bitcoin. (For now we fake it by generating a random number between 10k and 12k (or whatever makes sense when you get this assignment since bitcoin price is all over the place).
10.Putting it all together
It all sounds very complicated but really we are just keeping track of how many coins we actually have, as well as how much US dollars we have. When you buy coins your US dollars go down and the number of bitcoins goes up accordingly. When you sell coins your US balance goes up and the number of coins you have goes down. The variable that stores your actual US dollars (USD) does not really need to be in a class if you dont want it to be.
Please use Phyton to answer my questions~
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started