SOFTWARE ENGINEERING >C<
null Edition
ISBN: 9781323165331
Author: SOMMERVILLE
Publisher: PEARSON C
expand_more
expand_more
format_list_bulleted
Question
Chapter 4, Problem 4.5E
Program Plan Intro
Given Information:
An unattended petrol pump includes a credit card reader where the customer swipes the card through the reader and then specifies the amount of fuel required. Then the fuel is delivered and the customer’s account is debited. Then the cash-dispensing function in a bank ATM and the spelling-check and correcting function in a word processor.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Provide a minimum of ten (10) instances of different scenarios in which you are able to relate as a function. We ask that you refrain from copying the response from Google.
With regard to the following JavaScript program,
function main() {
function sub1()
var x = 10;
function sub2() {
var y = x;
}
function sub3()
var x = 5; var x = 20;
}
1) If it is interpreted using static-scoping rules. What value of x is displayed in functions sub1, sub2, and sub3 respectively? Why?
2) If it is under dynamic-scoping rules, what value of x is displayed in functions sub1, sub2, and sub3 respectively? Why?
Provide justification for the superiority of user-defined functions over built-in ones.
Chapter 4 Solutions
SOFTWARE ENGINEERING >C<
Ch. 4 - Identify and briefly describe four types of...Ch. 4 - Prob. 4.2ECh. 4 - Prob. 4.3ECh. 4 - Prob. 4.4ECh. 4 - Prob. 4.5ECh. 4 - Suggest how an engineer responsible for drawing up...Ch. 4 - Prob. 4.7ECh. 4 - Prob. 4.8ECh. 4 - When emergency changes have to be made to systems,...Ch. 4 - Prob. 4.10E
Knowledge Booster
Similar questions
- Consider the following program, written in JavaScript-like syntax: //main program var x, y, z function sub1(){ var a, y, z; …………. } function sub2(){ var a, b, z; …………… } function sub3(){ var a, x, w; …………… } Given the following calling sequences and assuming that dynamic scoping is used, what variables are visible during execution of the last subprogram activated? Include with each visible variable the name of the unit where it is declared. main calls sub1; sub1 calls sub 2; sub2 calls sub3. main calls sub1; sub1 calls sub3; sub3 calls sub2. main calls sub3; sub3 calls sub2; sub2 calls sub1.arrow_forwardConsider the following skeletal C program: void fun1(void); /* prototype */void fun2(void); /* prototype */void fun3(void); /* prototype */void main() { int a, b, c; . . .}void fun1(void) { int b, c, d; . . .}void fun2(void) { int c, d, e; . . .}void fun3(void) { int d, e, f; . . .}Given the following calling sequences and assuming that dynamic scoping is used, whatvariables are visible during the execution of the last function? Include with each visible variablethe name of the function in which it was defined.a. main calls fun1; fun1 calls fun2; fun2 calls fun3.b. main calls fun1; fun1 calls fun3.c. main calls fun2; fun2 calls fun3; fun3 calls fun1.d. main calls fun3; fun3 calls fun1.e. main calls fun1; fun1 calls fun3; fun3 calls fun2. Consider the following program, written in JavaScript-like syntax: // main programvar x, y, z;function sub1() {var a, y, z;. . .}function sub2() { var a, b, z; . . .}function sub3() { var a, x, w; . . .}Given the following calling sequences and…arrow_forwardCan you help me please with this issue I am having with C++ Write the definitions of the following functions: setWaitingTime getArrivalTime getTransactionTime getCustomerNumber of the class customerType //*************** customerType ************ void customerType::setCustomerInfo(int customerN, int arrvTime, int wTime, int tTime) { customerNumber = customerN; arrivalTime = arrvTime; waitingTime = wTime; transactionTime = tTime; } customerType::customerType(int customerN, int arrvTime, int wTime, int tTime) { setCustomerInfo(customerN, arrvTime, wTime, tTime); } int customerType::getWaitingTime() const { return waitingTime; } void customerType::incrementWaitingTime() { waitingTime++; }arrow_forward
- question 2 What is the difference between virtual and pure virtual functions. Explain the usage of virtual functions and discuss its pros and cons with examples.arrow_forwardShow how inline functions differ from normal functions in the process that occurs behind the scenes.arrow_forwardQuestion 2. Consider the following skeletal C program. void fun1(void) {int a, b, c;// call another function} void fun2(void) {int d, e, f;// call another function} void fun3(void) {int c, d, e;// call another function} void main () {int a, f, e;// call another function} Given the following calling sequences and assuming that dynamic scoping is used, whatvariables are visible during execution of the last function called? Include with each visiblevariable the name of the function in which it was defined. a. main calls fun1; fun1 calls fun3.b. main calls fun3; fun3 calls fun1.c. main calls fun1; fun1 calls fun3; fun3 calls fun2.d. main calls fun3; fun3 calls fun2; fun2 calls fun1arrow_forward
- Consider the following JavaScript skeletal program: //The main program var x; function sub1() { var x; function sub2() { . . . } } function sub3() { . . . } Assuming Dynamic scoping, which declaration of x will be used inthe following functions: a) sub1() b) sub2() c) sub3() You can consider the first declaration of x as x1 and the second as x2arrow_forwardWrite a function to describe the following scenario. Jonathan is selling his old trading cards. Each customer that buys gets the first box they purchase for $10, and each additional box for only $5.arrow_forwardSuppose that you wanted to design a function to send email to patrons of the library who have overdue books. Which of the following would be a plausible start? arrow_forward
- Concepts of programming language Consider the following JavaScript program: var a, y, c;function sub1() {var b, z, c;function sub2() {var a, b, y;. . .}. . .}function sub3() {var a, x, w;. . .}List all the variables, along with the program units where they are declared,that are visible in the bodies of sub2 when the sequence of function call is:“sub1 calls sub3 and sub3 calls sub2”, assuming dynamic scoping is used.arrow_forwardPlease explain why user-defined functions are preferable than pre-defined ones in the context of this discussion.arrow_forwardWe have been thinking about computer programs as sequences of instructions where the computer methodically executes one instruction and thenmoves on to the next one. Do programs that contain functions fit thismodel? Explain your answer.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education