Home / Expert Answers / Computer Science / this-is-a-project-and-its-a-go-program-assignment-i-have-posted-the-instructions-for-the-first-is-th-pa190

(Solved): this is a project and its a go program assignment i have posted the instructions for the first is th ...



this is a project and its a go program assignment i have posted the instructions for the first is the question , we are required to complete the code , if you see there are two instances of the code and one which must give answers in a terminal. please the part where the comments are and where you see the //complete code , thats where we need to complete. please give the complete code please i really need this
student submitted image, transcription available below

student submitted image, transcription available below

student submitted image, transcription available below

student submitted image, transcription available below

student submitted image, transcription available below
Background: John, a high school freshman, has just received a generous gift from his grandmother, Mrs. Mary Johns who is a retired financial advisor. John was not sure about what he wanted to do with this gift. So, he decided to talk with his grandmother. He called his grandma and asked if they could get together to get some ice cream and to talk about what to do with the gift that she gave him. Grandma was so happy that John called, and they agreed to go to their favorite ice cream shop on Saturday. Grandma picked up John on Saturday and drove to the ice cream shop. On the way, Grandma Mary asked John about what he wanted to do with the gift. John started thinking out loud about his options; he said: "I could save for a used car, or buy a new computer, or save up for a down payment on a house to buy once I graduate from college." Grandma was pleased to hear John thinking logically about his options. Because she worked many years as a financial advisor, grandma started asking him questions so he could evaluate his options and narrow them down. They arrived at the ice cream shop, and they ordered their ice cream. Then they continued their discussion about John's goals. John was leaning toward the third option - saving for a down payment on a house. Grandina was not surprised even a bit. She knew John very well; John has one of her amazing traits - delay of gratifieation. He did not want to spend his gift now; he wanted to save it for later so he would achieve something that is very important to him. John asked grandma about some ways he could invest his gift for eight years (four years of high school and four years of college). Also, John was turning 14 years old, and he told his grandma that he would be able to work few hours each week and could save a week. Grandma told John that he could open a mutual fund account with the . She said that there are many types of mutual funds. She explained to him about the two major vehicles of investment: bonds and stocks. Bonds' average annual yield is about 85.0 and stocks' average yield is about 9.08. However, stocks are riskier than bonds; they have wider swings in return (positive and negative) than bonds. Mrs. Johns knew that John was a cleaver Go programmer. So, she asked him to write a GO program to calculate the total amount that he could accumulate after eight years if he invested the as well as per month in bonds, stocks, or a mix of them. Also, grandma told him to assume that the return is monthly. John liked programming very much. He told his grandma "I can get it done in less than a week." Grandma told John "Great. Let's meet again when you get it done, and I will tell you more about investments then. Homework specification: You are provided with a file named "investmentTestDrive.go." This file is meant to be used for testing another type called Investment that you are required to write. The Investment type must be saved in a file called "investment.go" that must be placed in a folder/directory named "investment" where "InvestmentTestDrive.go" resides. The two files and the folders are provided in the accompanying code. The Investment type has methods with the following signatures: I* - Set rate of annual interest/dividend * I cannot be 0 or less func (i *Investment) SetRate( float64) error * Add money to the current balance * d cannot be 0.0 or less func (i * Investment) Deposit(d float64) error * Calculate monthly interest (dividend) and add it to the current * balance. The monthly interest is the annual interest divided by - 12. To calculate the monthly return on using 108 annual * return: * This equation will give the monthly interest that needs to be added * to the current balance. * Add money to the current balance * d cannot be 0.0 or less func (i * Investment) Deposit(d float64) error - Calculate monthly interest (dividend) and add it to the current * balance. The monthly interest is the annual interest divided by * 12. To calculate the monthly return on using 108 annual * return: * This equation will give the monthly interest that needs to be added * to the current balance. func (i * Investment) AddMonthlyInterest() * Return the current balance func (I * Investment) GetBalance() float64 In the investmentTestDrive.go File, write a function with the following signature: func test2(rate1 float64, rate2 float64) In this function, make two instances of the Investment type. Set the interest rate of the first to ratel and the interest rate of the second to rate2. Run this test in a similar way to the loop of test1. The point of this test is to calculate the balance after each month for the next eight years if John invested 208 of his money in bonds and 808 of his money in stocks. pockoge maln inport ( "fut" "has/investinent" ) - Save for a house down payment over 8 years, starting with . - Then deposite every week ( per month) for the next 8 years. func test1(rate float64) \{ var investment investment. Investment err1 : = investeent. SetRate (rate) if log, Fatal(err1) \} err2 :- investment.Deposit (3060.0) if err2 t mil t 10 . Fatal (err.2) \} for investinent. AddVonthly Interest() err3 :- investient.Deposit (400.0) if log. Fatal(err3) \} 3 I - ToDo: Write a test case for investing half of your money in - bonds and the other half in stocks func test2(rate1 float64, rate2 float 64) \{ 3 II Complete this function func nain() i fit.Printin("Investrent at annual rate of ) test fit.Printin("Investient at annual rate of 9.0K") test /I TODo: call your new test case here fat.Printin("Investient at annual rate of and test 3 Author: Hani Z. Girgis, PhD package investment import ( "errors" "fint" ) type Investment struct // complete this structure \} 1* * Set rate of annual interest/dividend * cannot be or less * func (i Investment) SetRate ( float64) error \{ If Complete this method \} * Add money to the current balance * d cannot be or less \%) func * Investment) Deposit(d float64) error \{ /I complete this method \} * Calculate monthly interest (dividend) and add it to the current - balance. The monthly interest is the annual interest divided by * 12. To calculate the monthly return on using annual * return: - This equation will give the monthly interest that needs to be added * to the current balance. \%) func : Investment) AddilonthlyInterest ()( /f Complete this method \} * Return the current balance \% func ( Investinent) GetBalance() floot64 If complete this method \}


We have an Answer from Expert

View Expert Answer

Expert Answer



We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe