Compute the weakest precondition for the following sequence of assignment statements and its post-condition: p = q - 3; p * 3 + 6; {Q: k <= 12} k
Q: Create an abstraction payroll c#
A: Here we have given abstraction payroll in C#. you can find the code in step 2.
Q: Which kind of parser is more powerful, bottom-up or top-down
A: Use as many examples as possible to support your viewpoint. Which kind of parser is more powerful,…
Q: Consider the following scenario: you've been assigned a project that necessitates the use of…
A: Introduction: Stochastic processes consist of random variables, which are members of mathematical…
Q: what is the advantage and disadvantage of overloading operators? ( please tell in simple language…
A: Solution : Operator Overloading Operator overloading occurs when an operator operates on a…
Q: Put the following predicate calculus expression in clause form: X [odd(X) [Y odd(mul(X, Y))]]
A:
Q: Explain what happens if you did not make sure and one of the previous properties (elements) does not…
A: About the previous properties does not exist but you designed a dynamic programming solution for the…
Q: Define strongly and loosely typed type checking. Discuss briefly, how strongly and loosly typed type…
A: Note: There are multiple questions given in one question. According to the rule, you will get the…
Q: For the shallow access method, which of the following statements are true? Subprogram linkage is…
A:
Q: In which type of language is a closure never necessary? dynamically scoped language that does…
A: Answer: Closures are useful in the following cases: dynamically scoped language that does NOT…
Q: To distribute an inheritance to VB Question: Write a program in the language of two people in a 1:3…
A: To distribute an inheritance to VB (Visual Basic) question: Write a program in the language of two…
Q: Explain the differences between C and C++ with the use of a scenario.
A: C and C++ are the programming language that are used for application development. The difference…
Q: Give an evaluation sequence in substitution model for each of the following Scheme expressions. The…
A: Scheme expressions Evaluation sequence in substitution model 1. (filter list? '(a (2) 5.5 (a . b) (3…
Q: Complete the following table by writing statements with combined assignment operators in the…
A: Combined assignment operator: They provide a shorter syntax of assigning the result of an…
Q: List of possible applications/softwares Production management application of "NADEK" Company. 2…
A:
Q: One possible solution to avoid functional side effects is to the use of 2-way parameters. (allow,…
A: One possible solution to avoid functional side effects is to disallow the use of 2-way parameters.
Q: PLEASE HELP!!! Write these rules in Python #name - a simple name for the rule (e.g., up, left, down,…
A: Start. Initialize the variables. Perform the operations. Print the output. Exit.
Q: 1. Consider the following structure of a procedure in a certain programming language procedure Big…
A: Static scoping is followed in most programming languages such as C++, and Java. Here, by merely…
Q: conditional functions of formatting using proper example
A: conditional functions of formatting using proper example
Q: Consider the following line of code: house nicosia; house famagusta(nicosia); house larnaca;…
A: Consider A to be class in C++, A a; // a is an object of A A b=a; //assignment operator A c(a);…
Q: Topic: Concepts of programming Language Compute the weakest precondition for the following…
A: Please refer below for your reference:
Q: sex, height & weight (The sex should be read into a single character variable). Each of the input…
A: Code: #include <iostream> using namespace std; bool checkHeight(int h,char g){…
Q: Explain how the call-by-value mechanism works, and how it differs from the call-by-reference…
A: The call by value mechanism can be illustrated by the following code segment : void main( ) { int a…
Q: Use code examples to differentiate between operator overloading and subprogram overloading.
A: When two or more methods in the same class have same name but the number of parameters passed and…
Q: How do you distinguish between a test criterion and a test requirement?
A: Definition: The tester is able to better organize the testing process with the assistance of test…
Q: Problem 24(a): Compute the weakest precondition for each of the following sequences of assignment…
A: Given following sequences of assignment statements: a = 2*b+1 --->1 b = a-3 ---> 2…
Q: Explain assert function.
A: Assert function Assertions are statements used to test assumptions made by programmer. It will…
Q: Write a program in c++ to find the transpose of a matrix. Matrix is to be stored in a class object…
A: Constructors are the same name as the class name in which these are automatically called when the…
Q: Describe the uses of reference parameters in different situations.
A: A reference parameter provides a reference to the memory location where the variable is stored. A…
Q: program in c++: Consider that a system has two entities, Employee and Department. The employee has…
A: EXPLANATION: - This program comprises of 2 header files that is, Employee.h, Department.h…
Q: Matlab will not stop you from overriding built-in identifiers. with that in mind, wchich variable…
A: MATLAB scripts store their variables in a workspace that is shared with the caller of the script.…
Q: In programming a good identifier is self-descriptive and mnemonic ("assisting memory" / "assists in…
A: In programming, a good identifier is a self-descriptive, and the mnemonic variable name that…
Q: Explain instance and local variable by giving an example
A: Instance variable is a variable which is a variable declared for an instance and its scope is…
Q: Give an example of how composition facilitates reusability. Distinguish between the rules IS-A rule…
A: Analyze the Issue: The issue is fundamental to OOP. It discusses the two fundamental principles of…
Q: Give an evaluation sequence in substitution model for each of the following Scheme expressions. The…
A: Answer : here is relevant function definitions : (define (square x) (* x x)) (define pi 3.14159)…
Q: 4- Write a program in C++ to find the value of Y for the following relationship: Y = (x3 + 1) 1/2 +…
A: Hello Student, Greetings Hope you are doing great. I will try my best to answer your question. Thank…
Q: Consider the grammar G where the start symbol isSwitha set of non-terminals{S A}, a set of…
A:
Q: ) Identify the correct variable name from the following? a. Weak Condtions b. Weak$Conditons…
A: Variable names should follow some rules and are as follows: Variable names can have alphabets,…
Q: Consider the assignment statement and post condition: a 3*b- 1; b = a+ 2; {b < 4} What is the…
A: The ask is to find the weakest pre-condition for the given example.
Q: The > relationship between use cases would be used when behavior in the extending use case is the…
A: I have given an answer in step 2.
Q: Poor readability and non-sense operations are expected True as a result of operator overloading.…
A: Correct answer of above given question is False. Explanation for why the correct answer is False is…
Q: Compute the weakest precondition for each of the following assignment statements and selection…
A: a) As a>0 and a = 2 * (b - 1) - 1 so, 2 * (b - 1) - 1>0 => 2b - 2 -1>0 => 2b…
Q: State the difference between actual and formal parameters. Give an example each for clarification.
A: - We need to highlight the contrast between actual and formal parameters.
Q: a. Provide two reasons why reference parameters are useful. b. How are reference parameters…
A: Program: A program is used to interact with the computer systems and provide the instructions to…
Q: Compute the weakest precondition for the following assignment statement and its postcondition. a-2…
A: a=2*(b-1)-1 {a>0}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- Redo Programming Exercise 1 by overloading the operators as nonmembers of the classrectangleType. Write a test program that tests various operations on the classrectangleType.Compute the weakest precondition for each of the following assignment statements and postconditions. x = 2 * y -5; y = x + 2; {y < 2}1.)Implement a program using the if-else selection structure. Develop a C program that computes the different roots in a quadratic equation, aX + bX2=0. r = -b ± √ (b2 – 4ac) , r1 is the root when the + is used in the equation and r2 is the root when 2a the – is used. The roots r1 and r2 can only be computed when the discriminant (b2 – 4ac) is greater than the zero else the quadratic equation does not have any roots and therefore the program should display “no roots”. NOTE: sqrt is a built in function in C to extract the roots. The program will prompt to input the values of a, b and c and output the roots r1 and r2 or no roots at all. Check your answer manually. 2.) Implement a program using the if-else selection structure. Input two numbers. Determine and print the larger number, smaller number. Also, print the two numbers in ascending and descending order. Test data: Enter 1st number: 4 /*inputs */ Enter 2nd number: 2 Smaller number : 2…
- In C++ 1. Declare, define, and test the following function to check for order by name:bool isSortedByName(const Student * sa, int size);2. Declare, define, and test the following function to check for order by ID:bool isSortedById(const Student * sa, int size);3. To print out a Boolean value as true or false, rather than 1 or 0, precede each with boolalpha:cout << "True is " << boolalpha << true << ", False is " << boolalpha << false <<endl;**use c++ and use string and vector abstract data types. Use iterators as appropriate. Design and implement an abstract data type called Car. Support the following operations: ability to set make and model, ability to shift gear up or down (assume a max of 6-speed), ability to shift lanes (left or right; assume a max of three lanes), accelerate and decelerate (in units of 5 mph), and display the current state of the car (show the make, model, current gear number, current lane and speed). Also, support operator overloading for a few operators that make sense for a Car object including: =, ==, < and >. Instantiate some Car objects in your main function and take them for a spin.Develop a substring operator using operator() in C++. The arguments should be the starting position for the substring and the length of the substring. The result should be a copy of the substring starting at the given position within our own data and ending at most the given length from the start. For example: Object's Value Operator Call Resulting Object's Value "bob wuz here" obj(0,4) "bob " "bob wuz here" obj(8,14) "here" (ran out of characters) "bob wuz here" obj(14,4) "" (nothing there) "bob wuz here" obj(4,1) "w" If the start position doesn't exist, send back an empty string (as we've defined). If there aren't 'length' characters left in our string after the given start position, return what we do have. Don't forget to write a test application to show that your operator works. (Perhaps you could modify the existing String test app?)
- Implement in C Programming 7.11.1: LAB: Student struct Given main(), build a struct called Student that represents a student that has two data members: the student's name (string) and the student's GPA (double). Assume student's name has a maximum length of 20 characters. Implement the Student struct and related function declarations in Student.h, and implement the related function definitions in Student.c as listed below: Student InitStudent() - initializes name to "Louie" and gpa to 1.0 Student SetName(char *name, Student s) - sets the student's name Student SetGPA(double gpa, Student s) - sets the student's GPA void GetName(char* studentName, Student s) - return the student's name in studentName double GetGPA(Student s) - returns the students GPA Ex. If a new Student object is created, the default output is: Louie/1.0 Ex. If the student's name is set to "Felix" and the GPA is set to 3.7, the output becomes: Felix/3.7 main.c #include <stdio.h> #include <string.h>…Use Clojure: a. See attached picture. b. In Clojure (like other functional programming languages) functions and variables are treated identically. This means a function may easily take another function as an argument, and/or return a function. Write a function swap-arg-order which takes a function (of two arguments) as an argument returns another function that does the same thing, but expects its two arguments in the opposite order.That is, for example• given the division function / which divides the first argument by the second (so (/ 3 6) returns the number 1/2), the following expression should evaluate to 2((swap-arg-order /) 3 6)• given the function list-longer-than? from above, the following expression should evaluate to true((swap-arg-order list-longer-than?) '(1 2 3) 2) c. Define a higher order function g so the following expression evaluates to true:(= 100 (g (fn [n] (* n n))))Consider the following predicates:Student(x): x is a studentSmart(x): x is smartLoves(x, y): x loves yTakes(x, z): x takes zand the following domains:domain of x and y: {all UB students}domain of z: {the courses offered by UB CSE}Express each of the following statements using quantifiers, logical connectives, and the predicates givenabove. You may use variables, other than x and y, when/if needed.Note: Alice and Bob are UB students. CSE115 is a course offered by UB CSE.a) There exists a smart student.b) Every student loves some other student.c) There is a student who is loved by every other student.d) Alice doesn’t take CSE 115.e) No student loves Bob.
- ) Define a struct type to represent a university student with a name, surname, course, year. 2) Define a couple of named instances, e.g., David, Pearl, Computing, Year1. 3) Apply selector function to return the course and year of your student.4) Write a function that updates the year of a student, i.e. if year is “Year1”, then update to “Year2”, if year is “Year2”, then update to “Year3”, if the year is “Year3” then updated to “Graduated”. Make sure to write what the difference between mutable and immutable is.Compute the weakest precondition for each of the following assignment statements and selection constructs. Detailed steps are needed. a = 2 * (b - 1) - 1 {a > 0} a = 2 * b + 1 b = a - 3 {b < 0} if (a == b) b = 2 * a + 1 else b = 2 * a {b > 1}Overload the following operators using c++ > < >= <= ==