Compute the weakest precondition for each of the following assignment statements and postconditions:

a = 2 * (b - 1) - 1 {a > 0}
b = (c + 10) / 3 {b > 6}
a = a + 2 * b - 1 {a > 1}
x = 2 * y + x - 1 {x > 11}

Answers

Answer 1

Answer:

a) b > 3/2

b) c > 8

c) b > 1 - a/2

d) y > 6 - x/2

Explanation:

a)

a = 2 × (b - 1) - 1   {a > 0}

2 × (b - 1) - 1 > 0

2b - 2 - 1 > 0

2b - 3 > 0

2b > 3

b > 3/2

b)

b = (c + 10) / 3 {b > 6}

(c + 10) / 3 > 6

multiply both side by 3

((c + 10) / 3) × 3 > 6 × 3

c + 10 > 18

c > 18 - 10

c > 8

c)

a = a + 2 × b - 1 {a > 1}

a + 2 × b - 1 > 1

a + 2b - 1 > 1

a + 2b > 1 + 1

2b > 2 - a

divide both sides by 2

2b/2 > 2/2 - a/2

b > 1 - a/2

d)

x = 2 × y + x - 1 {x > 11}

2 × y + x - 1 > 11

2y + x - 1 > 11

2y + x > 11 + 1

2y + x > 12

2y > 12 - x

divide both sides by 2

2y/2 > 12/2 - x/2

y > 6 - x/2


Related Questions

4.5 Lesson Practice edhesive

Answers

Answer:

Count Variable -- When it hits a limt.

using user input -- its true if the user input is the conditional variable needed to end it.

The two ways that one can end a loop are:

Using user input (Option B)- This is used when its true if the user input is the conditional variable  has to to terminate it;Count Variable (Option D) - When it hits a limit.

What is a loop?

In programming, the sequence of events (instruction) that continues to run repeatedly in the same chain is called a loop.

Thus, it is right to state that the two ways that one can end a loop are:

Using user input (Option B)- This is used when its true if the user input is the conditional variable  has to to terminate it;Count Variable (Option D) - When it hits a limit.

Learn more about loops at:
https://brainly.com/question/24052822
#SPJ9

Write a program that creates an integer array with 40 elements in it. Use a for loop to assign values to each element of the array so that each element has a value that is triple its index. For example, the element with index 0 should have a value of 0, the element with index 1 should have a value of 3, the element with index 2 should have a value of 6, and so on.

Answers

Answer:

public class Main

{

public static void main(String[] args) {

 int[] numbers = new int[40];

 for (int i=0; i<40; i++){

     numbers[i] = i * 3;

 }

 for (int i=0; i<40; i++){

     System.out.println(numbers[i]);

 }

}

}

Explanation:

*The code is in Java.

Initialize an integer array with size 40

Create a for loop that iterates 40 times. Inside the loop, set the number at index i as i*3

i = 0, numbers[0] = 0 * 3 = 0

i = 1, numbers[1] = 1 * 3 = 3

i = 2, numbers[2] = 2 * 3 = 6

.

.

i = 39, numbers[39] = 39 * 3 = 117

Create another for loop that iterates 40 times and prints the values in the numbers array

Describe an algorithm that takes as input a list of n integers in nondecreasing order and produces the list of all values that occur more than once. (

Answers

Answer:

Input a series of integer numbers and split the string from the input to get a list. Then check and convert each string to integer with a list comprehension. Create a new variable with a value equal to the set of the list ( to get unique values) then check for the occurrence of each value in the original list.

Explanation:

This algorithm is used to check for the occurrence of values in a list that has been sorted in ascending order. This is faster if the items in the list is not converted to integer yet (still strings) before writing a for loop to check the value count in the list.

Bibliography
There are some formatting errors in this bibliography
page. Which corrections should be made? Check all
that apply
O The title should be in bold.
O There should be a double space between each
citation
Amber, Claire. "How Would Gandhi Respond?"
The World Post. TheHuffington Post.com,
16 Sept. 2011. Web. 28 Feb. 2014.
Wilkinson, Philip. Gandhi: The Young Protester
Who Founded a Nation. Washington, DC:
National Geographic Society, 2005. Print.
Eknath, Easwaran. Gandhi the Man: How One
Man Changed Himself to Change the World.
Tomales, CA: Nilgiri, 2011. Print.
O The citation entries should be in alphabetical order.
The web sources should be listed first.
The second and third lines of the last entry should
be indented

Answers

Answer:

There should be a double space between each citation

The citation entries should be in alphabetical order.

The second and third lines of the last entry should be indented

Explanation:

The bibliography page contains some formatting errors which should be corrected before it is standard and acceptable.

First of all, in MLA (and most other styles), it is important to double space each citation to make them easily readable and eliminate errors.

Next, the citation entries needs to be in alphabetical order and not random which makes it easy to find a source.

Also, there needs to be indentation in the second and third lines of the last entry.

Answer:

B,C,E is the answer

Explanation:

I got it right on test...

sorry if its too late

Hope it helps someone else :D

No variables and only in one lines

Answers

In python 3.8, we can use a simple print statement.

print(('h0 '*3 +'Merry Christmas\n')*2)

give the one simple program using c++programming language​

Answers

Answer:

the ejedjrjr eenekrr

eueeue

Explanation:

u4rururirw

References inserted initially as footnotes can be converted to endnotes through an option in the software.

A. True

B. False

Answers

The answer is A. True

The answer is: A) True

I need help with my homework:
Greetings, secret agent 00111! Your mission, should you choose to accept it, is to help Agent M plan a pizza party. Unfortunately, M has no idea how much pizza to order for his 83 guests. Luck for him, party planning is your specialty! Estimate the number of pizzas he’ll need on scratch paper, and then convert that number to binary and write it here.

Answers

Answer:

You need to order 11100 pizzas.

Explanation:

A couple of assumptions here.

Each pizza has 12 slices.  Each guest will eat 4 slices (1/3 of a pizza).

83 * 1/3 = 28 pizzas

28 = 11100

Write a function named power that accepts two parameters containing integer values (x and n, in that order) and recursively calculates and returns the value of x to the nth power.

Answers

Answer:

Following are the code to the given question:

int power(int x, int n)//defining a method power that accepts two integer parameters

{

if (n == 0)//defining if block to check n equal to 0

{

return 1; //return value 1

}

else//defining else block

{

x = x * power(x, --n); //use x variable to call method recursively

}

return x; //return x value

}

Explanation:

In the above-given code, a method power is defined that accepts two integer variable in its parameter, in the method a conditional statement is used which can be defined as follows:

In the if block, it checks "n" value, which is equal to 0. if the condition is true it will return value 1.In the else block, an integer variable x is defined that calls the method recursively and return x value.

A Protocol for networked information​

Answers

Answer:

Internet Protocol (IP), which uses a set of rules to send and receive messages at the Internet address level; and. additional network protocols that include the Hypertext Transfer Protocol (HTTP) and File Transfer Protocol (FTP), each of which has defined sets of rules to exchange and display information.

Explanation:

could i plz have brainliest so close to next rank

Ask the user how many numbers for which they want to calculate the sum. Using a for loop, prompt the user to enter that many numbers, one-by-one, keeping track of the sum. At the end, after the user entered all numbers, output the sum.

Answers

n = int(input("How many numbers do you want to sum? "))

total = 0

for x in range(n):

   total += int(input("Enter a number: "))

print("Sum: "+str(total))

I hope this helps!

Following are the program to the given question:

Program Explanation:

Defining a variable "Sum" that holds an integer value.In the next step, a variable "t" is defined that uses the input method to input a value from the user-end.After the input value, a for loop is declared that takes the range of the t variable.Inside the loop, another variable "n" is defined that inputs value from user-end and use the "Sum" variable to add its value.Outside the loop, a print method has been used that prints the sum variable in the string with the message.  

Program:

Sum = 0#defining a variable sum that hold an integer value

t= int(input("Enter the total number you want to add: "))#defining a t variable that input value from user-end

for i in range(t):#defining a loop that add inputs values from above user-input range

   n= int(input("Enter value "+str(i+1)+": "))#defining loop that inputs n value

   Sum += n; #defining sum variable that adds user-input value

print("Sum of entered number: "+str(Sum))#using print method that print added value

Output:

Please find the attached file.

Learn more:

brainly.com/question/16025032

4. Word Separator:Write a program that accepts as input a sentence in which all of thewords are run together but the first character of each word is uppercase. Convert the sentence to a string in which the words are separated by spaces and only the first word starts with an uppercase letter. For example the string “StopAndSmellTheRoses.” would be converted to “Stop and smell the roses.”
*python coding

Answers

sent = input("")

count = 0

new_sent = ""

for i in sent:

   if count == 0:

       new_sent += i

       count += 1

   else:

       if i.isupper():

           new_sent += " "+i.lower()

       else:

           new_sent += i

print(new_sent)

The above code works if the user enters the sentence.

def func(sentence):

   count = 0

   new_sent = ""

   for i in sentence:

       if count == 0:

           new_sent += i

           count += 1

       else:

           if i.isupper():

               new_sent += " " + i.lower()

           else:

               new_sent += i

   return new_sent

print(func("StopAndSmellTheRoses."))

The above code works if the sentence is entered via a function.

Write a statement that calls the recursive method backwardsAlphabet() with parameter startingLetter.

Answers

Answer:

Explanation:

public class RecursiveCalls {

public static void backwardsAlphabet(char currLetter) {

if (currLetter == 'a') {

System.out.println(currLetter);

}

else {

System.out.print(currLetter + " ");

backwardsAlphabet(--currLetter);

}

return;

}

public static void main (String [] args) {

char startingLetter = '-';

startingLetter = 'z';

// Your solution goes here

backwardsAlphabet(startingLetter);

return;

}

}

What term refers to a sequence of statements in a language that both humans and computers can understand?

a
hexadecimal
b
program
c
binary
d
macro

Answers

Answer your answer is Macro

Explanation:

Macro shares language both the computer and the programmer can undestand.

What was that show where lowe’s were based off eye colors and the main character had orange eyes that let her mind control people. It was either on netflix or hulu

Answers

The Innocents on Hulu i think

Answer:Raising Dion?

Explanation:

Was it Raising Dion?

Dance dance1 = new Dance("Tango","Hernandos Hideaway");
Dance dance2 = new Dance("Swing","Hound Dog");
System.out.println(dance1.toString());

System.out.println(dance2.toString());

class Dance
{
private String name;
private String song;

public Dance(String name, String s)
{
this.name = name;
song = s;
}

public String toString()
{
return name + " " + song;
}
}
What is printed when the program is executed?


a
null null

null null

b
Hernandos Hideaway null

Hound Dog null

c
null null

Swing Hound Dog

d
Tango Hernados Hideaway

Swing Hound Dog

e
null Hernandos Hideaway

null Hound Dog

Answers

Answer:

The output of the program is (d)

Tango Hernados Hideaway

Swing Hound Dog

Explanation:

Analyzing the given code segment

In class Dance,

A method named dance was defined with an instance of two string variables/values

which are name and song

public Dance(String name, String s)

In the main of the program,

The first line creates an instance of Dance as dance1

dance1 is initialized with the following string values: "Tango","Hernandos Hideaway"

- The first string value "Tango" will be passed into the name variable of the Dance method

- The second string value "Hernandos Hideaway" will be passed into the song variable of the Dance method

Next, another instance of Dance is initialized as dance2

dance2 is initialized with the following string values: "Swing","Hound Dog"

- The first string value "Swing" will be passed into the name variable of the Dance method

- The second string value "Hound Dog" will be passed into the song variable of the Dance method

On line 3 of the main: System.out.println(dance1.toString());

The values of dance1, which are "Tango","Hernandos Hideaway" are printed

On line 4 of the main: System.out.println(dance2.toString());

The values of dance1, which are "Swing","Hound Dog" are printed

Hence, option d answers the question

what program we write for nested if in c++ to print something after else part but before inner if else
if(condition){
}
else
//something we want to print
if(condition){
}
else{
}

Answers

Answer:

if(condition){

}

else  {

  // something we want to print

  if(condition) {

     // ...

  }

  else {

     // ...

  }

}

Explanation:

Create code blocks using curly braces { ... }.

Use proper indentation to visibly make it clear where code blocks start and end.

Write an application that counts the total number of spaces contained in a quote entered by the user.

Answers

Answer:

Explanation:

The following code is written in Java. It asks the user for an input and saves it in a String variable. Then it loops through all the characters in the string and counts the spaces. Finally, it prints the total number of spaces in the String.

public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter Line Now:");

       String userInput = in.nextLine();

       int spaceCount = 0;

       for (int x = 0; x < userInput.length(); x++) {

           if (userInput.charAt(x) == ' ') {

               spaceCount++;

           }

       }

       System.out.println(spaceCount);

   }

Assume you have 100 values that are all different, and use equal width discretization with 10 bins.
a) What is the largest number of records that could appear in one bin?
b) What is the smallest number of records that could appear in one bin?
c) If you use equal height discretization with 10 bins, what is largest number of records that can appear in one bin?
d) smallest?
e) Now assume that the maximum value frequency is 20. What is the largest number of records that could appear in one bin with equal width discretization (10 bins)?
f) . What about with equal height discretization (10 bins)?

Answers

Answer:

a) 10

b) 1

C) 10

D) 1

E) 20

F)  10

Explanation:

a) The largest number of records that could appear in one bin

 = 10

B) The smallest number of records that could appear in one bin

= 1

C) The largest number of records that cab appear in one bin

= 10

d) smallest number

= 1

e) With frequency = 20. the largest number of records that could appear in one bin with equal width discretization (10 bins)

= 20

f ) with equal height discretization

= 10

Write an expression that will print "in high school" if the value of user_grade is between 9 and 12 (inclusive).

Answers

Answer:

C#

if(user_grade >=9 && user_grade <=12)

{

   Console.WriteLine("In Highschool");

}

Python

if user_grade >= 9 & user_grade <= 12:

  print("In Highschool")

Java

if(user_grade >=9 && user_grade <=12)

{

   System.println("In Highschool");

}

Explanation:

Write a function named minMax() that accepts three integers arguments from the keyboard and finds the smallest and largest integers. Include the function minMax() in a working program. Make sure your function is called from main().Test the function by passing various combinations of three integers to it.

Answers

Answer:

public class Main

{

public static void main(String[] args) {

 minMax(1, 2, 3);

 minMax(100, 25, 33);

 minMax(11, 222, 37);

}

public static void minMax(int n1, int n2, int n3){

    int max, min;

    if(n1 >= n2 && n1 >= n3){

        max = n1;

    }

    else if(n2 >= n1 && n2 >= n3){

        max = n2;

    }

    else{

        max = n3;

    }

   

    if(n1 <= n2 && n1 <= n3){

        min = n1;

    }

    else if(n2 <= n1 && n2 <= n3){

        min = n2;

    }

    else{

        min = n3;

    }

    System.out.println("The max is " + max + "\nThe min is " + min);    

}

}

Explanation:

*The code is in Java.

Create a function named minMax() that takes three integers, n1, n2 and n3

Inside the function:

Declare the min and max

Check if n1 is greater than or equal to n2 and n3. If it is set it as max. If not, check if n2 is greater than or equal to n1 and n3. If it is set it as max. Otherwise, set n3 as max

Check if n1 is smaller than or equal to n2 and n3. If it is set it as min. If not, check if n2 is smaller than or equal to n1 and n3. If it is set it as min. Otherwise, set n3 as min

Print the max and min

Inside the main:

Call the minMax() with different combinations

IN PYTHON LANGUAGE

(1) Prompt the user to enter two words and a number, storing each into separate variables. Then, output those three values on a single line separated by a space. (Submit for 1 point)

Enter favorite color:
yellow
Enter pet's name:
Daisy
Enter a number:
6
You entered: yellow Daisy 6

(2) Output two passwords using a combination of the user input. Format the passwords as shown below. (Submit for 2 points, so 3 points total).

Enter favorite color:
yellow
Enter pet's name:
Daisy
Enter a number:
6
You entered: yellow Daisy 6

First password: yellow_Daisy
Second password: 6yellow6

(3) Output the length of each password (the number of characters in the strings). (Submit for 2 points, so 5 points total).

Enter favorite color:
yellow
Enter pet's name:
Daisy
Enter a number:
6
You entered: yellow Daisy 6

First password: yellow_Daisy
Second password: 6yellow6

Number of characters in yellow_Daisy: 12
Number of characters in 6yellow6: 8

Answers

Answer:

favorite_color = input('Enter favorite color:\n')

pet_name = input("Enter pet's name:\n")

number = input('Enter a number:\n')

print('You entered:',favorite_color+' '+pet_name+' '+number)

password1 = favorite_color+'_'+pet_name

password2 = number+favorite_color+number

print('\nFirst password:'+' '+password1)

print('Second password:'+' '+password2)

print('\nNumber of characters in '+password1+': '+str(len(password1)))

print('Number of characters in '+password2+': '+str(len(password2)))

Explanation:

Notice on the pet name I used quotes instead of parenthesis because so I can use the comma on pet's.

This solution worked for me.

What is the best prediction she could make about this
semester's text?
Natalia's class read Shakespeare's Romeo and Juliet
last semester and took a field trip to see it performed
live in a community theater. Today, Natalia learned that
her class will read another work by Shakespeare this
semester
It is a play.
It is an adventure.
It is a fairy tale.
It is a fable.

Answers

Answer:its a play

Explanation:

Answer:

A. It is a play

Explanation:

Got the answer correct on the quiz

When tracking time for subcontractors, which QuickBooks window is used to enter subcontractor information? Vendors List Payroll Setup Item List Employee List

Answers

Answer:

Vendors list

Explanation:

The answer to this question is the vendors list. The Vendor List can be defined as a selected or contracted list of suppliers that is needed for a project or company.

The vendor list a quickbooks window that is used to enter subcontractor information. Quickbooks definition of a vendor is a person from whom a product is purchased

what is the CPU's role?

Answers

Answer:

The CPU performs basic arithmetic, logic, controlling, and input/output (I/O) operations specified by the instructions in the program. The computer industry used the term "central processing unit" as early as 1955.

Answer:

The Cpu is like the brain of the computer it's responsible for everything from running a program to solving a complex math equation.

Computer Architecture
1. Define what a "word" is in computer architecture:
A. The size (number of bits) of the address
B. The total number of bits of an instruction (e.g. 16 bits)
C. Word and width are synonymous.
D. A word is the contents of a memory register.
2. What is the difference between a register’s width and a register’s address? (choose all that apply - there may be more than one correct answer)
A. They are both the same!
B. Address is the same for all registers, width is unique for each register.
C. Width is the amount of data a single register holds, address is the location of the register within a larger chip.
D. The address bits of a register is a logarithm of its width.
3. Which of the following is NOT implemented by the Program Counter?
A. Set the counter to 0.
B. Increase the counter by 1.
C. Decrease the counter by 1.
D. Set the counter to any input value.
4. What is the relationship between the size of the address (number of bits) and the word size for memory registers?
A. address bits = 2^(word size)
B. address bits = word size ^ 2
C. address bits = word size
D. address bits = log2(word size)
E. address bits = (word size) / 2

Answers

Answer:

BADDA

Explanation:

BIIING

salvado has a flash disk of 1.5GB and wants to store more music files of 950KBs each . How many files will he be able to store on his flash disk?​

Answers

Answer:

Convert 1.5GB to KBs = 1500000kb

1500000kb/950kb ≈ 1579

Explanation:

A flash disk is a storage device. It has enough memory to store large files. In the given question, the flash disk has a memory of 1.5GB and can store 1578.94 music files of 950KBs each.

What is flash disk?

A flash disk is a data storage device that uses flash memory specifically : a small rectangular device which is designed to be plugged directly into a USB port on a computer. It is often used for transferring files from one computer to another computer system.

Flash disks have no mechanical platters or access arms. It is termed "disk" because of the data which are accessed as if they were on a hard drive. The disk storage structure is emulated.

In the given question, the flash disk contains 1.5GB memory and has to store music files of 950KBs each. For determining the number of music files which can be stored in the flash disks, we have to first convert the unit of flash disk from GB to KB:

1GB = 1,000,000 KB

1.5 GB = 1,500,000 KB

size of music file = 950 KB

Number of music files that can be stored = storage in the flash disk ÷ size of the music file

Number of music files = 1500000KB ÷ 950KB

Number of music files = 1578.94

Learn more about Flash disk here:

https://brainly.com/question/1130880

#SPJ2

server.
10. The Domain Name refers to the
a) Mail
b) Google
c) Internet
d) Local

Answers

Answer:

C.

Explanation:

answer 1 question and get 10 points in return

Answers

Answer:

3

Explanation:

sorry if I'm wrong...it's been a while since I took a coding class.

3 I think... hope this helps!

True/False: A datasum can be generated for any width of data. For example, we can create an 8, 16, or 32 bit datasum for 8, 16, or 32 bit data elements respectively.

Answers

Answer:

true

Explanation:

Other Questions
Solve this equation: 123(3x5)=12(2x+1) Who knows how to do this One Sentence Explaining the cotton gin.oMllL 20 less than the sum of eight and a number? Whos Danny in warriors dont cry Pls help! I suck at this! Just tell me the definition of the words, no need for a picture (if u can even put one) All elements are composed of extremely small particles called Tickets to a baseball game cost $22 each and parking costs $10. What is the equation of the line that represents the cost of attending the game? y-22=10x y=22x-10 y=22x+10 22x+y=10 Which type of bond shares the electrons between two elements? My arms are aching now because...... since two o'clock . a) I am swimming b ) I swam. c) I swim d) I have been swimming A Strike Out is when the batter attempts to hit the ball and misses three times. A. True B. False According to Charles Law, if I __________ the Kelvin temperature, it will __________ the volume. i need genuine suggestions of music to listen to while studying what is the provision made by the constitution regarding religious freedom If x = 0 and y < 0, where is the point (x, y) located? Two trains leave stations 324 miles apart at the same time and travel toward each other. One train travels at 100 miles per hour while the other travels at 80 miles per hour. How long will it take for the two trains to meet? Do not do any rounding. Kendall bought a vase that was priced at $450. in addition, she had to pay 3% sales tax. How much did she pay for the vase? (05.03 LC)Read the dialogue and question. Then, choose the correct option.Marta: Hola, Pedro. Ests perdido?Pedro: S, y no tengo el sistema de posicionamiento global.What might Marta's response to Pedro be?Question 9 options:Necesitas buscar un mapa.Necesitas llegar al metro.Necesitas rentar un carro. Fill in the blank in the following dialogue with the appropriate word below.- Qui vient au cinma avec moi?ne va au cinma avec toi! On prfre regarder la tl!A. RienB. PersonneC. JamaisD. Quelqu'un A 30 kg box is being pulled with a force of 125 N. The coefficient of static friction between the box and the floor is 0.35. What is the minimum downward force on the box that will keep it from slipping?