Printing the two stocks in portfolio


Assignment task: Suppose that you have "Stock X" and "Stock Y" in your portfolio. You want to obtain an output in the following way:

- If mystock is Stock X, print "Stock X is in your portfolio."

- If mystock is Stock Y, print "Stock Y is in your portfolio."

- If mystock is neither Stock X nor Stock Y, print "This is not in your portfolio."

You start with the following code:

mystock <- "Stock Y"

That is, you assigned "Stock Y" into mystock. Now, the following is the structure of nested "if else" statement to allow you to print three alternatives.

mystock <- "Stock Y"

if (mystock == "Stock X") {

  print _____(a)_____

} else {

  _____(b)_____

    _____(c)_____

  _____(d)_____

    _____(e)_____

  }

}

Request for Solution File

Ask an Expert for Answer!!
Other Subject: Printing the two stocks in portfolio
Reference No:- TGS03230780

Expected delivery within 24 Hours