Answer:
The function is as follows:
def addingAllTheWeirdStuff(array1,array2):
sumOdd = 0
for i in array2:
if i % 2 == 1:
sumOdd+=i
for i in array1:
if i < 10:
sumOdd+=i
print("Sum:",sumOdd)
sumEven = 0
for i in array1:
if i % 2 == 0:
sumEven+=i
for i in array2:
if i > 10:
sumEven+=i
print("Sum:",sumEven)
Explanation:
This declares the function
def addingAllTheWeirdStuff(array1,array2):
This initializes the sum of odd numbers in array 2 to 0
sumOdd = 0
This iterates through array 2
for i in array2:
This adds up all odd numbers in it
if i % 2 == 1:
sumOdd+=i
This iterates through array 1
for i in array1:
This adds up all elements less than 10 to sumOdd
if i < 10:
sumOdd+=i
This prints the calculated sum
print("Sum:",sumOdd)
This initializes the sum of even numbers in array 1 to 0
sumEven = 0
This iterates through array 1
for i in array1:
This adds up all even numbers in it
if i % 2 == 0:
sumEven+=i
This iterates through array 2
for i in array2:
This adds up all elements greater than 10 to sumEven
if i > 10:
sumEven+=i
This prints the calculated sum
print("Sum:",sumEven)
discuss three ways in which the local government should promote safe and healthy living
Answer:
1. Secure drinkable water
2. Promote organic products through the provision of subsidiaries
3. Create a place for bioproducts to be sold
Explanation:
Whether drinking, domestic, food production, or for leisure purposes, safe and readily available water is important for public health. Better water supply and sanitation and improved water resource management can boost economic growth for countries and can make a significant contribution towards reduced poverty.some of the claimed benefits of organic food:Without the use of pesticides and chemical products, organic farming does not toxic residues poison land, water, and air. Sustainable land and resource use in organic farming. Crop rotation promotes healthy and fertile soil.
In conventional farming, the use of pesticides contaminates runoff, which is a natural part of the water cycle. In groundwater, surface water, and rainfall, pesticide residues are found. This means that in food produced with pesticides, contamination may not be isolated, but also affect the environment.
Create a place for bioproducts to be sold
Biologics offer farmers, shippers, food processors, food retailers, and consumers a wide range of benefits. Biocontrols can also help protect the turf, ornamentals, and forests in addition to food use. They can also be used for disease and harm controls in public health, i.e., mosquitoes and the control of ticks.
The benefits of the use of biologicals in farming applications tend to be more direct, though they are indirect. The list includes benefits to crop quality and yield which help farmers supply consumer products worldwide with healthy and affordable fruit and vegetables. Biocontrols also allow farmers in their fields to maintain positive populations of insects (natural predators) through their highly-target modes of action, reducing their reliance on conventional chemical pesticides.
Please answer
NO LINKS
Answer:
Please find the attached file for the complete solution:
Explanation:
or Java,
program to perform this computa
3.
Isaac Newton devised a clever method to casily approximate the square root of a number without having
to use a calculator that has the square root function. Describe this method with illustration
Answer:
The illustration in Java is as follows:
import java.util.*;
import java.lang.Math.*;
class Main{
public static void main (String[] args){
Scanner input = new Scanner(System.in);
double num, root, temp;
num = input.nextDouble();
temp = num;
while (true){
root = 0.5 * ( (num / temp)+temp);
if (Math.abs(root - temp) < 0.00001){
break; }
temp = root; }
System.out.println("Root: "+root);
}}
Explanation:
This declares all necessary variables
double num, root, temp;
This gets input for num (i.e the number whose square root is to be calculated)
num = input.nextDouble();
This saves the input number to temp
temp = num;
This loop is repeated until it is exited from within the loop
while (true){
Calculate temporary square root
root = 0.5 * ( (num / temp)+temp);
The loop is exited, if the absolute difference between the root and temp is less than 0.00001
if (Math.abs(root - temp) < 0.00001){
break; }
Save the calculated root to temp
temp = root; }
This prints the calculated root
System.out.println("Root: "+root);
which of the following indicates that the loop should stop when the value in the quantity variable is less than the number 50
Answer:
while (quantity >= 50)
Explanation:
Required
Stop when quantity is less than 50
To do this, we make use of a while statement and the syntax is:
while (condition){ }
If the loop should stop when quantity is less than 50; then it means the loop would continue when quantity is greater or equal to 50
So, we have:
while (quantity >= 50)
(Ramanujan's Taxi) Srinivasa Ramanujan indian mathematician who became famous for his intuition for numbers. When the English mathemematician G.H. Hardy came ot visit him in the hospital one day, Hardy remarked that the number if his taxi was 1729, a rather dull number. To which Ramanujan replied, "No, Hardy! It is a very interesting number. It is the smallest number expressible as the sum of two cubes in two different ways." Verify this claim by writing a program Ramanujan.java that takes a command-line argument N and prints out all integers less than or equal to N that can be expressed as the sum of two cubes in two different ways. In other words, find distinct positive integers a, b, c, and d such that а3 + b3 = c3 - d3. Hint: Use four nested for loops, with these bounds on the loop variables: 0 < a < 3√N, a < b < 3√N - a3, a < c < 3√N and c < d < 3√N - C3; do not explicitly compute cube roots, and instead use x . x *x < y in place of х < Math.cbrt (y).
$ javac Ramanujan.java
$ java Ramanujan 40000
1729 = 1"3 + 12^3 = 9^3 + 10"3
4104 = 2^3 + 16^3 = 9^3 + 15^3
13832 = 2^3 + 24^3 = 18^3 + 20^3
39312 = 2^3 + 34^3 = 15^3 + 33^3
32832 = 4^3 + 32^3 = 18^3 + 30^3
20683 = 10^3 + 27^3 = 19^3 + 24^3
Answer:
Here the code is given as follows,
Explanation:
Code:
public class Ramanujan {
public static void main(String[] args) {
// check cmd argument
int n = Integer.parseInt(args[0]);
// checking a^3 + b^3 = c^3 + d^3
// outer loop
for (int a = 1; (a*a*a) <= n; a++) {
int a3 = a*a*a;
// no solution is possible, since upcoming a values are more
if (a3 > n)
break;
// avoid duplicate
for (int b = a; (b * b * b) <= (n - a3); b++) {
int b3 = b*b*b;
if (a3 + b3 > n)
break;
// avoid duplicates
for (int c = a + 1; (c*c*c) <= n; c++) {
int c3 = c*c*c;
if (c3 > a3 + b3)
break;
// avoid duplicates
for (int d = c; (d * d * d) <= (n - c3); d++) {
int d3 = d*d*d;
if (c3 + d3 > a3 + b3)
break;
if (c3 + d3 == a3 + b3) {
System.out.print((a3+b3) + " = ");
System.out.print(a + "^3 + " + b + "^3 = ");
System.out.print(c + "^3 + " + d + "^3");
System.out.println();
}
}
}
}
}
}
}
Design a function char maxChar (char,char)- to return the smallest character from the arguments.
in java please please
Answer:
Following are the program to the given question:
public class Main//defining Main method
{
char maxChar (char x1,char x2)//defining a method maxChar that takes two char parameter
{
if(x1<x2)//use if to compare char value
{
return x1;//return first char value
}
else//else block
{
return x2;//return second char value
}
}
public static void main(String[] args)//defining main method
{
char x1,x2;//defining char variable
x1='d';//use char to hold value
x2='a';//use char to hold value
Main ob=new Main();//creating class Object
System.out.println(ob.maxChar(x1,x2));//calling method and prints its return value
}
}
Output:
a
Explanation:
In this code, a method "maxChar" is defined that holds two char variable "x1,x2" in its parameters, and use if conditional statement that checks the parameter value and print its return value.
In the main method, two char variable is declared that hold char value and passing the value in the method and prints its return value.
HELP ITS A TESTTT!!!Which symbol shows auto correct is in use?
A-a white light bulb
B-A green plus sign
C-A flashing red circle
D-A yellow lightning bolt
Answer:
D
Explanation:
A technician is able to connect to a web however, the technician receives the error, when alternating to access a different web Page cannot be displayed. Which command line tools would be BEST to identify the root cause of the connection problem?
Answer:
nslookup
Explanation:
Nslookup command is considered as one of the most popular command-line software for a Domain Name System probing. It is a network administration command-line tool that is available for the operating systems of many computer. It is mainly used for troubleshooting the DNS problems.
Thus, in the context, the technician receives the error "Web page cannot be displayed" when he alternates to access different web page, the nslookup command is the best command tool to find the root cause of the connection problem.
A python code only runs the except block when _____. Group of answer choices all the statements in the try block are executed an error occurs in the preceding try block the programmer manually calls the except block an error occurs anywhere in the code
Answer:
Python only running exception block when try block fails
Explanation:
i do cyber security and i was learning this in high school
In Python, try and except statements are used to catch and manage exceptions. Statements that can generate exceptions were placed within the try clause, while statements that handle the exception are put within the except clause.
An exception should be caught by except block, which is used to test code for errors that are specified in the "try" block. The content of the "except" block is executed if such a fault/error appears.In Python, the exception block only runs when an error occurs in the try block.Therefore, the answer is "try block fails ".
Learn more:
brainly.com/question/19154398
trình bày ngắn gọn hiểu biết của bản thân về mạng máy tính theo mô hình OSI hoặc TCP/IP
Answer:
OSI đề cập đến Kết nối hệ thống mở trong khi TCP / IP đề cập đến Giao thức điều khiển truyền. OSI theo cách tiếp cận dọc trong khi TCP / IP theo cách tiếp cận ngang. Mô hình OSI, lớp truyền tải, chỉ hướng kết nối trong khi mô hình TCP / IP là cả hướng kết nối và không kết nối.
Explanation:
dab
Solve the following linear program graphically (each line represents one unit). The feasible region is indicated by the shading and the corner points have been listed for you. Determine the objective function value at the corner points and indicate the optimal solution (if any). Minimize: Z
Answer:
(a): The value of the objective function at the corner points
[tex]Z = 10[/tex]
[tex]Z = 19[/tex]
[tex]Z = 15[/tex]
(b) The optimal solution is [tex](6,2)[/tex]
Explanation:
Given
[tex]Min\ Z = X_1 + 2X_2[/tex]
Subject to:
[tex]-2X_1 + 5X_2 \ge -2[/tex] ---- 1
[tex]X_1 + 4X_2 \le 27[/tex] ---- 2
[tex]8X_1 + 5X_2 \ge 58[/tex] --- 3
Solving (a): The value of the at the corner points
From the graph, the corner points are:
[tex](6,2)\ \ \ \ \ \ (11,4)\ \ \ \ \ \ \ \ (3,6)[/tex]
So, we have:
[tex](6,2)[/tex] ------- Corner point 1
[tex]Min\ Z = X_1 + 2X_2[/tex]
[tex]Z = 6 + 2 * 2[/tex]
[tex]Z = 6 + 4[/tex]
[tex]Z = 10[/tex]
[tex](11,4)[/tex] ------ Corner point 2
[tex]Min\ Z = X_1 + 2X_2[/tex]
[tex]Z = 11 + 2 * 4[/tex]
[tex]Z = 11 + 8[/tex]
[tex]Z = 19[/tex]
[tex](3,6)[/tex] --- Corner point 3
[tex]Min\ Z = X_1 + 2X_2[/tex]
[tex]Z = 3 + 2 * 6[/tex]
[tex]Z = 3 + 12[/tex]
[tex]Z = 15[/tex]
Solving (b): The optimal solution
Since we are to minimize Z, the optimal solution is at the corner point that gives the least value
In (a), the least value of Z is: [tex]Z = 10[/tex]
So, the optimal solution is at: corner point 1
[tex](6,2)[/tex]
Create a program that simulates a race between several vehicles. Design and implement an inheritance hierarchy that includes Vehicle as an abstract superclass and several subclasses
Answer:
Explanation:
The following program is written in Java. Since there was not much information provided in the question I created a Vehicle superclass with a couple of subclasses for the different types of vehicles (motorcycle, sedan, truck). Each one having its own unique attributes. The vehicle class also has an attribute for the position of the vehicle in the race.
class Vehicle {
int year, wheels, position;
public Vehicle(int year, int wheels, int position) {
this.year = year;
this.wheels = wheels;
this.position = position;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public int getWheels() {
return wheels;
}
public void setWheels(int wheels) {
this.wheels = wheels;
}
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
}
class Motorcycle extends Vehicle {
String manufacturer;
double speed;
public Motorcycle(int year, int wheels, int position) {
super(year, wheels, position);
}
public Motorcycle(int year, int wheels, int position, String manufacturer, double speed) {
super(year, wheels, position);
this.manufacturer = manufacturer;
this.speed = speed;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public double getSpeed() {
return speed;
}
public void setSpeed(double speed) {
this.speed = speed;
}
}
class Sedan extends Vehicle {
int passengers;
String manufacturer;
double speed;
public Sedan(int year, int wheels, int position) {
super(year, wheels, position);
}
public Sedan(int year, int wheels, int position, int passengers, String manufacturer, double speed) {
super(year, wheels, position);
this.passengers = passengers;
this.manufacturer = manufacturer;
this.speed = speed;
}
public int getPassengers() {
return passengers;
}
public void setPassengers(int passengers) {
this.passengers = passengers;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public double getSpeed() {
return speed;
}
public void setSpeed(double speed) {
this.speed = speed;
}
}
class Truck extends Vehicle {
int passengers;
String manufacturer;
double speed;
public Truck(int year, int wheels, int position) {
super(year, wheels, position);
}
public Truck(int year, int wheels, int position, int passengers, String manufacturer, double speed) {
super(year, wheels, position);
this.passengers = passengers;
this.manufacturer = manufacturer;
this.speed = speed;
}
public int getPassengers() {
return passengers;
}
public void setPassengers(int passengers) {
this.passengers = passengers;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public double getSpeed() {
return speed;
}
public void setSpeed(double speed) {
this.speed = speed;
}
}
Create a list of lists, named hamsplits, such that hamsplits[i] is a list of all the words in the i-th sentence of the text. The sentences should be stored in the order that they appear, and so should the words within each sentence. Regarding how to break up the text into sentences and how to store the words, the guidelines are as follows: Sentences end with '.', '?', and '!'. You should convert all letters to lowercase. For each word, strip out any punctuation. For instance, in the text above, the first and last sentences would be: hamsplits[0] == ['and', 'can', 'you', 'by', ..., 'dangerous', 'lunacy'] hamsplits[-1] == ['madness', 'in', 'great', ..., 'not', 'unwatchd', 'go']
Answer:
Explanation:
The following code is written in Python. It takes in a story as a parameter and splits it into sentences. Then it adds those sentences into the list of lists called hamsplits, cleaned up and in lowercase. A test case is used in the picture below and called so that it shows an output of the sentence in the second element of the hamsplits list.
def Brainly(story):
story_split = re.split('[.?!]', story.lower())
hamsplits = []
for sentence in story_split:
hamsplits.append(sentence.split(' '))
for list in hamsplits:
for word in list:
if word == '':
list.remove(word)
What are interpersonal skills for non-technical user
Answer:Non-Technical Skills ('NTS') are interpersonal skills which include: communication skills; leadership skills; team-work skills; decision-making skills; and situation-awareness skills.
Explanation:
What is the function of hard disk Which Computer was the first Computer to be developed
Answer:
The hard disk is a storage device designed to permanently store data, being secondary to the software in the computer. The ENIAC was the first modern computer to be developed and built, completing construction in 1946 and taking three years to build, but if ancient computers (people who computed by hand) are factored in, then the first computer would be way back in time, perhaps even extending to the B.C. years.
Explanation:
Hope this helped!
Information systems cannot solve some business problems. Give three examples and explain why technology cannot help
Answer:
The following are brief descriptions or the three examples of the declaration presented.
Explanation:
The information capable of supplying just the data in a method to achieve the following objectives. However, the machine cannot decide about the company.Technology is unable to document as well as to adapt it according to the scenario, everything remains to be accomplished by hand.Individuals must thus recognize but instead capitalize mostly on regions of opportunity.Marketing có phải là bán hàng hay không? Giải thích?
Answer:
Sự khác biệt giữa bán hàng và tiếp thị là bán hàng tập trung vào làm việc trực tiếp với khách hàng tiềm năng để khiến họ chuyển đổi, trong khi tiếp thị tập trung vào việc khơi dậy sự quan tâm đến sản phẩm của bạn.
Answer:
Marketing không phải là bán hàngg
Explanation:
Nó là công cụ hỗ trợ cho việc bán hàng
Questions to ask people on how corona has affected the religion sectors
Answer:
bcoz of corona all churches and temples are closed and pilgrimage are cancelled
which of the following is an example of how science can solve social problems?
It can reduce the frequency of severe weather conditions.
It can control the time and day when cyclones happen.
It can identify the sources of polluted water.
It can stop excessive rain from occurring.
Answer:
It can identify the sources of polluted water.
Explanation:
Science can be defined as a branch of intellectual and practical study which systematically observe a body of fact in relation to the structure and behavior of non-living and living organisms (animals, plants and humans) in the natural world through experiments.
A scientific method can be defined as a research method that typically involves the use of experimental and mathematical techniques which comprises of a series of steps such as systematic observation, measurement, and analysis to formulate, test and modify a hypothesis.
An example of how science can solve social problems is that it can identify the sources of polluted water through research, conducting an experiment or simulation of the pollution by using a computer software application.
In conclusion, science is a field of knowledge that typically involves the process of applying, creating and managing practical or scientific knowledge to solve problems and improve human life.
Answer:
It can identify the sources of polluted water.
Explanation:
computer is an ............. machine because once a task is intitated computer proceeds on its own t ill its completion.
Answer:
I think digital,versatile
computer is an electronic digital versatile machine because once a task is initiated computer proceeds on its own till its completation.
Find the basic period and basic frequency of the function g(t)=8cos(10πt)+sin(15πt)
Answer:
The period is
[tex]\frac{2\pi}{5} [/tex]
The frequency is
[tex] \frac{5}{2\pi} [/tex]
Explanation:
The period of both functions will be LCM of both period.
The period of cos is
[tex] \frac{\pi}{5} [/tex]
The period of sin is
[tex] \frac{2\pi}{15} [/tex]
Let convert each into degrees.
[tex] \frac{\pi}{5} = 36[/tex]
[tex] \frac{2\pi}{15} = 24[/tex]
Find the least common multiple between 36 and 24, which is 72.
Convert 72 into radians
[tex]72 = \frac{2\pi}{5} [/tex]
The period is 2pi/5.
The frequency is equal to
1/period.
so the frequency is
[tex] \frac{1}{ \frac{2\pi}{5} } = \frac{5}{2\pi} [/tex]
My iPhone XR screen is popping out. Is it because I dropped it?
Answer:
Yes that is most likely why your screen is popping out.
Explanation:
Most likely
what are the functions of the windows button, Task View and Search Box? give me short answer
Answer:
Windows button = You can see a Start Menu
Task view = You can view your Tasks
Search Box = You can search any app you want in an instance
What intangible benefits might an organization obtain from the development of an
information system?
Answer:
The immaterial benefits stem from the development of an information system and cannot easily be measured in dollars or with confidence. Potential intangible advantages include a competitive need, timely information, improved planning and increased flexibility in organisation.
Explanation:
Intangible advantages
Take faster decisionsCompetitive needMore information timelyNew, better or more information availability.Lower productivity and the lack of 'think outside' employees and managers as well as greater sales include the intangible costs of such an operational environment. All these factors improve when employees spend less of their time in addressing current methods of operation and are concerned about whether they will have a job or an employer in six months or a year. The automation level envisaged in this new system should enhance the overall efficiency of management. The operative controls and design functions should be simplified by tight system integrations with accessible automated database sources. However, it is difficult to describe the exact form of these simplifications.
Tangible costs of the new system include costs of analysis, design and construction of the system, such as the recruitment of contractors or new employees, and the assignment of existing staff. Also consideration shall be given to hardware, software purchased and operating costs. Intangible costs include disturbances to the current activities caused by development and deployment and potential adverse effects on the morals of employees.
While the new system may feel good in the long term, short-term stress and other negative consequences will still be present. In the way that Reliable does virtually everything, the system is the focus of a major change. An organisation's monumental change has widespread negative effects on operations and employees.
Think Critically 5-1 Creating Flexible Storage.
It's been 6 months since the disk crash at CSM Tech Publishing, and the owner is breathing a little easier because you installed a fault-tolerant solution to prevent loss of time and data if a disk crashes in the future. Business is good, and the current solution is starting to get low on disk space. In addition, the owner has some other needs that might require more disk space, and he wants to keep the data on separate volumes. He wants a flexible solution in which drives and volumes aren't restricted in their configuration. He also wants to be able to add storage space to existing volumes easily without having to reconfigure existing drives. He has the budget to add a storage enclosure system that can contain up to 10 HDDs. Which Windows feature can accommodate these needs, and how does it work?
Answer:
The Storage Spaces feature in Windows
Explanation:
The Storage Spaces feature can be used here. This feature was initiated in Windows server 2012 and allows the user store his files on the cloud or virtual storage. This makes it possible to have a flexible storage as there is a storage pool which is updated with more storage capacity as it decreases. The feature also offers storage security, backing up files to other disks to protect against total loss of data on a failed disk.
Which of the following statements describes a limitation of using a computer simulation to model a real-world object or system?
a. Computer simulations can only be built after the real-world object or system has been created.
b. Computer simulations only run on very powerful computers that are not available to the general public.
c. Computer simulations usually make some simplifying assumptions about the real-world object or system being modeled.
Answer:
The answer is "Option c".
Explanation:
Computer simulation, use of a machine to simulate a system's vibration signals by another modeled system's behaviors. A simulator employs a computer program to generate a mathematical model or representation of a true system. It usually gives a lot of simplifications concerning the physical image or system that is modeled, so this statement describes the limitation of using a computer simulation in modeling a real-world object or process.
Clocks (also called timers) are essential to the operation of any multiprogrammed system. They maintain the time of day, and prevent one process from monopolizing the CPU. How are clocks implemented
Answer:
The answer is below
Explanation:
The clock in the CPU is made of three elements including the following:
1. Crystal oscillator
2. A counter
3. A holding register
All these clock elements combined and generate interrupts at known periods or duration.
However, the clock has a powered battery back up which is implemented with a form of low-power circuitry similar to that of digital watches.
The purpose is to prohibit the current time from being failed when the computer is powered off or shut down.
A network technician is planning to update the firmware on a router on the network. The technician has downloaded the file from the vendor's website. Before installing the firmware update, which of the following steps should the technician perform to ensure file integrity?
a. Perform antivirus and anti-malware scans of the file.
b. Perform a hash on the file for comparison with the vendor’s hash.
c. Download the file a second time and compare the version numbers.
d. Compare the hash of the file to the previous firmware update.
Answer: B. Perform a hash on the file for comparison with the vendor’s hash.
Explanation:
Before installing the firmware update, the step that the technician should perform to ensure file integrity is to perform a hash on the file for comparison with the vendor’s hash.
Hashing refers to the algorithm that is used for the calculation of a string value from a file. Hashes are helpful in the identification of a threat on a machine and when a user wants to query the network for the existence of a certain file.
Given two integers as user inputs that represent the number of drinks to buy and the number of bottles to restock, create a VendingMachine object that performs the following operations:
Purchases input number of drinks
Restocks input number of bottles
Reports inventory
The VendingMachine is found in VendingMachine.java. A VendingMachine's initial inventory is 20 drinks.
Ex: If the input is:
5 2
the output is:
Inventory: 17 bottles
Need this answer in java! !!!!!!!!!!!!
Answer:
import java.util.Scanner;
class Main {
public static void main (String args[])
{
Scanner input = new Scanner(System.in);
VendingMachine machine = new VendingMachine(20);
System.out.print("Enter nr to purchase: ");
int nrPurchased = input.nextInt();
System.out.print("Enter nr to re-stock: ");
int nrRestock = input.nextInt();
machine.Transaction(nrPurchased, nrRestock);
input.close();
}
}
class VendingMachine {
private int inventory;
public VendingMachine(int initialInventory) {
inventory = initialInventory;
}
public void Transaction(int nrToBuy, int nrToRestock) {
inventory += nrToRestock - nrToBuy;
System.out.printf("Inventory: %d bottles.\n", inventory);
}
}
The program is an illustration of a sequential program, and it does not require loops, iterations and branches.
The program in java, where comments are used to explain each line is as follows:
import java.util.Scanner;
class Main {
public static void main (String args[]){
//This creates a scanner object
Scanner input = new Scanner(System.in);
//This gets input for the number of purchases
int Purchased = input.nextInt();
//This gets input for the number of restocks
int Restock = input.nextInt();
//This calculates and prints the inventory
System.out.print("Inventory: "+(20 - Purchased + Restock)+" bottles");
}
}
At the end of the program, the net inventory is printed.
Read more about similar programs at:
https://brainly.com/question/22851981
A compound Boolean expression created with the __________ operator is true only if
both of its subexpressions are true.
a. and
b. or
c. not
d. both
Answer:
the answer is AND
Explanation:
The condition is " both of its sunexpressions are true"
So OR us not the answer. Not and Borh are not the proper Boolean language.