##############################################################################
# Packages
library(exams)
library(manacc)
library(tidyverse)
library(knitr)
library(kableExtra)
library(randomNames)


##############################################################################
# Initialization
question_id <- "EN00000039"
wdir <- getwd()
parameters <- teachR::param_quest(wdir, question_id, alttype = "mcq", altlevel = "3 Apply")
for (i in 1:length(parameters)) assign(names(parameters)[[i]], parameters[[i]])
options(xtable.comment = FALSE, xtable.floating = FALSE, xtable.timestamp = "")
set.seed(seed)


##############################################################################
# Preparation
basepar <- manacc::income_statements(basevol = 20000, profitable = c(TRUE,TRUE))
company <- basepar$company[[1]]
product <- basepar$product[[1]]
singular <- basepar$singular[[1]]
plural <- basepar$plural[[1]]

person <- manacc::make_persons(2)
currentmonth <- lubridate::month(Sys.Date(), label = TRUE, abbr = FALSE)
lastmonth <- lubridate::month(Sys.Date()-30, label = TRUE, abbr = FALSE)

special_order <- manacc::da_take_or_leave(
  vol = basepar$vol[[1]],
  p = basepar$p[[1]],
  uvc = basepar$uvc[[1]],
  fc = basepar$fc[[1]],
  chg_p = 1
)


##############################################################################
# Answers

if (reqexpl != "" & exasolu == "exam" & type_table != "html") lines <- paste0("\\vspace{",15,"cm}") else lines <- rep(" \\ ", 2)
#lines <- rep("\\ ", 2)

rightnei <- special_order$solution[1]
wrongnei <- sample(special_order$wrong_nei,4)

rightnei <- case_when(
  rightnei < 0 ~ paste0("Operating Income would decrease by ", currencysymb, writR::dbl(abs(rightnei)), "."),
  TRUE ~ paste0("Operating Income would increase by ", currencysymb, writR::dbl(abs(rightnei)), ".")
)
wrongnei <- case_when(
  wrongnei < 0 ~ paste0("Operating Income would decrease by ", currencysymb, writR::dbl(abs(wrongnei)), "."),
  TRUE ~ paste0("Operating Income would increase by ", currencysymb, writR::dbl(abs(wrongnei)), ".")
)

questions <- c(rightnei, wrongnei)

solutions <- c(TRUE, rep(FALSE,4))

explanations <- c(
  "",
  "",
  "",
  "",
  ""
)


##############################################################################
# Randomize order (do not edit)
alea <- sample(c(1, sample(2:length(questions), (alternatives-1))), alternatives)
questions <- questions[alea]
solutions <- solutions[alea]
explanations <- explanations[alea]

Question

r txt_question_id r person$first_name[[1]] r person$last_name[[1]] is the Chief Marketing Officer (CMO) of r company, a company producing and selling r product. The normal sales volume is r writR::int(special_order$base$vol[[1]]) r plural per month, for a maximum capacity of production of r writR::int(special_order$base$cap[[1]]) r plural.
\ A foreign customer recently approached the company to buy r writR::int(special_order$base$vol[[2]]) units of an altered version of r singular. This product is usually sold for r currencysymb r writR::dbl(special_order$base$p[[1]]) per unit and has a unit variable cost of r currencysymb r writR::dbl(special_order$base$uvc[[1]]).
\ The modifications requested by this potential customer would increase the unit variable cost by r currencysymb r writR::dbl(special_order$base$uvc[[2]] - special_order$base$uvc[[1]]) and require some specific equipment, increasing the current monthly fixed costs of r currencysymb r writR::dbl(special_order$base$fc[[1]]) by an amount of r currencysymb r writR::dbl(special_order$base$fc[[2]]). The customer is willing to pay a premium for this special item, buying each r singular for a unit price of r currencysymb r writR::dbl(special_order$base$p[[2]]).
\ Assuming that the normal prices and reputation of the company would not be affected, and taking into consideration the limited capacity of production, what would be the net economic impact of accepting this special order? r reqexpl r points

if (reqexpl == "") exams::answerlist(questions, markup = "markdown") else writeLines(lines)

Solution

Since the number of units ordered exceeds the maximum capacity of production, normal sales are affected. The net economic impact of the special order is therefore its total contribution margin earned on that order, minus the increase in fixed costs it entails, minus the contribution margin lost on normal sales.

The change in normal sales is given by:

\begin{equation} \text{Change in normal sales} = r writR::int(special_order$base$cap[[1]]) - r writR::int(special_order$base$vol[[1]]) - r writR::int(special_order$base$vol[[2]]) = r writR::int(special_order$base$chg_vol[[1]])
\end{equation
}

Therefore, the net economic impact is:

\begin{equation} \begin{aligned} \text{+ Contribution Margin earned on the special order } & = + r writR::int(special_order$base$vol[[2]]) \times (r writR::dbl(special_order$base$p[[2]]) - r writR::dbl(special_order$base$uvc[[2]])) \ \text{- Additional fixed costs } & = - r writR::dbl(special_order$base$fc[[2]]) \ \text{- Contribution Margin lost on normal sales } & = - r writR::int(abs(special_order$base$chg_vol[[1]])) \times (r writR::dbl(special_order$base$p[[1]]) - r writR::dbl(special_order$base$uvc[[1]])) \ \ \text{= Net economic impact} & = r writR::dbl(special_order$solution[[1]]) \end{aligned} \end{equation}

if (reqexpl == "") exams::answerlist(ifelse(solutions, "True", "False"), explanations, markup = "markdown") else writeLines(c("\\ ","\\ "))

Meta-information

extype: r extype exsolution: r exams::mchoice2string(solutions, single = TRUE) exname: r question_id



NicolasJBM/manacc documentation built on Jan. 16, 2020, 1:42 p.m.