;; Functions (defvar *balance* 100) (defun withdraw (amount) (if (>= *balance* amount) (progn (:= *balance* (- *balance*
Fantastic news! We've Found the answer you've been seeking!
Question:
;; Functions (defvar *balance* 100) (defun withdraw (amount) (if (>= *balance* amount) (progn (:= *balance* (- *balance* amount)) *balance*) (format t "Insufficient funds~%"))) ;; Test cases (deftest test-withdraw () (:= *balance* 100) ; sets the bank account balance (check (equal (withdraw 10) 90) (equal (withdraw 20) 70))) (deftest test-deposit () ; You will complete this test case in Exercise 1 ) (defun main () (test-withdraw) (test-deposit))
attach and submit the following file(s) only:
- bank-account.lisp
Transcribed Image Text:
Preamble In the following text, $ denotes the shell prompt, c- is the Ctrl prefix of a keystroke command sequence in emacs, M- represents the Esc prefix of a keystroke command sequence. For example: • To execute the emacs keystroke command C-k, press and release Ctrl and k simultaneously • To execute the emacs keystroke command M-x, press and release Esc, then press and release x. • To execute the emacs keystroke command sequence C-x C-f, press and release Ctrl and x simultaneously, then press and release Ctrl and f simultaneously. BONUS HINT: to cancel a command c-g. This command is especially useful when you mistype an emacs command sequence. Preparing your lab folder 1. Type the following command in the shell terminal (text preceded by # are just comments) $emacs - nw # open a new emacs process within the terminal 2. To launch the emacs shell, type the emacs command M-x (press and release Esc then press and release x), then type eshell in the minibuffer, and press Enter. This will create a new terminal buffer inside emacs. 3. Type the following commands in the emacs shell to create the lab01 folder in your home directory $ cd $ mkdir CPS305 $ cd CPS305 $ mkdir Lab01 $ cd Lab01 # change to the home directory # create directory CPS305 #change to directory CPS305 # create directory Labe1 # change to directory Lab01 If for some reason you mistyped the name of a folder, use the shell command mv to correct it. For example, suppose you typed lab1 instead of Lab01. You can correct the folder name via the following command $ mv lab1 Labe1 4. Copy the file unit-test-frwkr.lisp provided in the course lab page (at my.ryerson.ca) to your Lab01 directory. Inside this file, there will be a unit test language that is used in this lab. Preamble In the following text, $ denotes the shell prompt, c- is the Ctrl prefix of a keystroke command sequence in emacs, M- represents the Esc prefix of a keystroke command sequence. For example: • To execute the emacs keystroke command C-k, press and release Ctrl and k simultaneously • To execute the emacs keystroke command M-x, press and release Esc, then press and release x. • To execute the emacs keystroke command sequence C-x C-f, press and release Ctrl and x simultaneously, then press and release Ctrl and f simultaneously. BONUS HINT: to cancel a command c-g. This command is especially useful when you mistype an emacs command sequence. Preparing your lab folder 1. Type the following command in the shell terminal (text preceded by # are just comments) $emacs - nw # open a new emacs process within the terminal 2. To launch the emacs shell, type the emacs command M-x (press and release Esc then press and release x), then type eshell in the minibuffer, and press Enter. This will create a new terminal buffer inside emacs. 3. Type the following commands in the emacs shell to create the lab01 folder in your home directory $ cd $ mkdir CPS305 $ cd CPS305 $ mkdir Lab01 $ cd Lab01 # change to the home directory # create directory CPS305 #change to directory CPS305 # create directory Labe1 # change to directory Lab01 If for some reason you mistyped the name of a folder, use the shell command mv to correct it. For example, suppose you typed lab1 instead of Lab01. You can correct the folder name via the following command $ mv lab1 Labe1 4. Copy the file unit-test-frwkr.lisp provided in the course lab page (at my.ryerson.ca) to your Lab01 directory. Inside this file, there will be a unit test language that is used in this lab.
Expert Answer:
Answer rating: 100% (QA)
Here are the solutions for the exercises in the bankaccountlisp file based on the given requirements Functions defvar balance 100 defun withdraw amoun... View the full answer
Posted Date:
Students also viewed these programming questions
-
If you deposit $10,000 in a bank account that pays 10% interest annually, how much will be in your account after 5 years?
-
If you deposit %10,000 in a bank account that pays 10 percent interest annually, how much would be in your account after 5 years?
-
You would like to deposit funds in an investment account and make equal, annual withdrawals of $75,000 per year, beginning exactly 1 year from today and continuing for 15 years, after which time the...
-
Under unit-based absorption costing systems, are high- or low-volume products overcosted? Why?
-
Consider the following problem. Maximize Z = 2x1 + x2, Subject to and x1 ¥ 0, x2 ¥ 0. I (a) Solve this problem graphically. (b) Use the upper bound technique manually to solve this problem....
-
Meiji Isetan Corp. of Japan has two regional divisions with headquarters in Osaka and Yokohama. Selected data on the two divisions follow (in millions of yen, denoted by): Required: 1. For each...
-
(a) As the electric motor shown schematically in Figure P28.30 operates, which of the arrows shown could represent the magnetic dipole moment at various instants? (b) If there are any arrows that are...
-
If a firms earnings per share grew from $1 to $2 over a 10-year period, the total growth would be 100 percent, but the annual growth rate would be less than 10 percent true or false? Explain.
-
11. Combustion of 1 mole of C6H6(l) inside a closed container of constant volume liberates 900 kJ of heat energy. What would be the value of heat liberated per mole of C6H6(l) if the reaction occurs...
-
Using the following information on Rockboro Case please answer the following Question: What are the problems here, and what do you recommend and what are the implications of different payout levels...
-
Susans Shoe Shop opened on January 1. The following transactions took place during the first month: 1. Deposited $30,000 in the firms checking account. 2. Purchased shoes, boots, socks, and other...
-
We have the following code: Make an edit to this code. What variable can we globalize to simplify the methods? You can also change the method definitions. Note you dont need to worry about how we...
-
With reference to CAATs, explain briefly: (i) The test data technique. (ii) Three types of audit software.
-
Frequently, the project's tasks are not well defined, and there is an urge to "get on with the work," since time is critical. How serious is it to minimize the planning effort and get on with the...
-
How does the reliability of healthcare services affect the quality of care you receive? What type of healthcare service do you find to be the least reliable in delivering a quality product? What type...
-
A hospital made 225 medication errors last year. Of these errors, 30 percent were errors with the prescription, while 70 percent were errors made while dispensing the medication. The hospital...
-
3. [%6] You are considering two retransmission strategies for all hosts in a network using the ALOHA protocol. The first is a deterministic strategy where the first time a collision is detected, the...
-
Determine the reactions in supports A and D and connections B and C. Sketch its shear and moment diagram and determine the magnitude ankoration of the maximum shear and moment for every member. 18 3...
-
Figure P4.2 shows the velocity of a block of wood as a function of time. The block is sliding over a horizontal surface. Describe the physical processes that led to this graph. Data from Figure P4.2...
-
Consider the two velocity-versus-time graphs shown in Figure P4.4. Are the motions represented by these curves best described as similar or as different? Is the effect of friction on the motion...
-
The velocity-versus-time graph in Figure P4.3 shows the motion of two different objects sliding across a horizontal surface. Could the change in the \(x\) component of velocity with time be...
Study smarter with the SolutionInn App