Write a program in Python representing 7 logic gates:

AND
NAND
OR
NOR
XOR
XNOR
NOT
Accept (only) two inputs to create all outputs.
Use the if statement to perform the Boolean logic.
Only accept numeric input.
If a number is greater than 0 treat it as a 1.
Specify in your output and in the beginning of the code (through print statements) which gate the code represents.
Comment your code.

Answers

Answer 1

Answer:

The program in python is as follows:

a = int(input("A: "))

b = int(input("B: "))

if a != 0:

   a= 1

if b != 0:

   b = 1

print("A AND B",end =" ")

if a == b == 1:

   print("True")

else:

   print("False")

print("A NAND B",end =" ")

if a == 0 or b == 0:

   print("True")

else:

   print("False")

print("A OR B",end =" ")

if a == 1 or b == 1:

   print("True")

else:

   print("False")

print("A NOR B",end =" ")

if a == 1 or b == 1:

   print("False")

else:

   print("True")

print("A XOR B",end =" ")

if a != b:

   print("True")

else:

   print("False")

print("A XNOR b",end =" ")

if a == b:

   print("True")

else:

   print("False")

print("NOT A",end =" ")

if a == 1:

   print("False")

else:

   print("True")

print("NOT B",end =" ")

if b == 1:

   print("False")

else:

   print("True")

Explanation:

These get inputs for A and B

a = int(input("A: "))

b = int(input("B: "))

a and b are set to 1 for all inputs other than 0

if a != 0:

   a= 1

if b != 0:

   b = 1

This prints the AND header

print("A AND B",end =" ")

AND is true if only A and B are 1

if a == b == 1:

   print("True")

else:

   print("False")

This prints the NAND header

print("A NAND B",end =" ")

NAND is true if one of A or B is 0

if a == 0 or b == 0:

   print("True")

else:

   print("False")

This prints the OR header

print("A OR B",end =" ")

OR is true if one of A or B is 1

if a == 1 or b == 1:

   print("True")

else:

   print("False")

This prints the NOR header

print("A NOR B",end =" ")

NOR is false if one of A or B is 1

if a == 1 or b == 1:

   print("False")

else:

   print("True")

This prints the XOR header

print("A XOR B",end =" ")

XOR is true if A and B are not equal

if a != b:

   print("True")

else:

   print("False")

This prints the XNOR header

print("A XNOR b",end =" ")

XNOR is true if a equals b

if a == b:

   print("True")

else:

   print("False")

This prints NOT header for A

print("NOT A",end =" ")

This prints the opposite of the input

if a == 1:

   print("False")

else:

   print("True")

This prints NOT header for B

print("NOT B",end =" ")

This prints the opposite of the input

if b == 1:

   print("False")

else:

   print("True")


Related Questions

What has happened (or is still happening) to make this speech occur? armageddon

Answers

Answer:

Are you talking about the bruce willis is superman basically? Because if so i don't think so because that is a future event that hasn't happened yet also that film sucks.

Explanation:

In a relational database, the three basic operations used to develop useful sets of data are:_________.
a. select, project, and join.
b. select, project, and where.
c. select, from, and join.
d. select, join, and where.

Answers

In a relational database, the three basic operations used to develop useful sets of data are:

[tex]\sf\purple{a.\: Select, \:project,\: and\: join. }[/tex]

[tex]\large\mathfrak{{\pmb{\underline{\orange{Mystique35 }}{\orange{❦}}}}}[/tex]

The basic operations used to develop useful sets of data in relational database are Select, Project and Join.

The Select and Project are of important use in selecting columns or attributes which we want to display or include in a table.

The join function allows the merging of data tables to form a more complete and all round dataset useful for different purposes.

Hence, the basic operations are select, project, and join.

Learn more : https://brainly.com/question/14760328

5. Name the special window that displays data, when you insert a chart.

a) Datasheet b) Database c) Sheet​

Answers

Answer:

A.Datasheet

Explanation:

I hope it's helpful

Design a class named Employee. The class should keep the following information in member variables:
Employee name
Employee number
Hire Date
Write one or more constructors and the appropriate accessor and mutator functions for the class.
Next, write a class named ProductionWorker that is derived from the Employee class. The ProductionWorker class should have member variables to hold the following information:
Shift (an integer)
Hourly pay rate (a double)
The workday is divided into two shifts: day and night. The shift variable will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Write one or more constructors and the appropriate accessor and mutator functions for the class. Demonstrate the classes by writing a program that uses a ProductionWorker object."
Now I have written out the program, it compiles without errors. However, when I run it It asks the first question "Employees name" after input it errors and closes itself down. Can anyone find where in my code it is causing it to do this please? To be clear, I am not asking for someone to write the program, I have already done this, just need to know why it compiles but does not run all the way through. Thank You!
#include
#include
#include
using namespace std;
class Employee
{
private:
string employeeName;
int employeeNumber;
int hireDate;
public:
void setemployeeName(string employeeName);
void setemployeeNumber(int);
void sethireDate(int);
string getemployeeName() const;
int getemployeeNumber() const;
int gethireDate() const;
Employee();
{

Answers

Answer:

Here is the code.

Explanation:

#include <iostream>

#include <cstdlib>

#include <string>

#include <iomanip>

using namespace std;

class Employee

{

private:

string employeeName;

int employeeNumber;

int hireDate;

public:

void setemployeeName(string employeeName);

void setemployeeNumber(int);

void sethireDate(int);

string getemployeeName() const;

int getemployeeNumber() const;

int gethireDate() const;

Employee();

};

void Employee::setemployeeName(string employeeName)

{

employeeName = employeeName;

}

void Employee::setemployeeNumber(int b)

{

employeeNumber = b;

}

void Employee::sethireDate(int d)

{

hireDate = d;

}

string Employee::getemployeeName() const

{

return employeeName;

}

int Employee::getemployeeNumber() const

{

return employeeNumber;

}

int Employee::gethireDate() const

{

return hireDate;

}

Employee::Employee()

{

cout << "Please answer some questions about your employees, ";

}

class ProductionWorker :public Employee

{

private:

int Shift;

double hourlyPay;

public:

void setShift(int);

void sethourlyPay(double);

int getShift() const;

double gethourlyPay() const;

ProductionWorker();

};

void ProductionWorker::setShift(int s)

{

Shift = s;

}

void ProductionWorker::sethourlyPay(double p)

{

hourlyPay = p;

}

int ProductionWorker::getShift() const

{

return Shift;

}

double ProductionWorker::gethourlyPay() const

{

return hourlyPay;

}

ProductionWorker::ProductionWorker()

{

cout << "Your responses will be displayed after all data has been received. "<<endl;

}

int main()

{

ProductionWorker info;

string name;

int num;

int date;

int shift;

double pay;

cout << "Please enter employee name: ";

cin >> name;

cout << "Please enter employee number: ";

cin >> num;

cout << "Please enter employee hire date using the format \n";

cout << "2 digit month, 2 digit day, 4 digit year as one number: \n";

cout << "(Example August 12 1981 = 08121981)";

cin >> date;

cout << "Which shift does the employee work: \n";

cout << "Enter 1, 2, or 3";

cin >> shift;

cout << "Please enter the employee's rate of pay: ";

cin >> pay;

info.setemployeeName(name);

info.setemployeeNumber(num);

info.sethireDate(date);

info.setShift(shift);

info.sethourlyPay(pay);

cout << "The data you entered for this employee is as follows: \n";

cout << "Name: " << info.getemployeeName() << endl;

cout << "Number: " << info.getemployeeNumber() << endl;

cout << "Hire Date: " << info.gethireDate() << endl;

cout << "Shift: " << info.getShift() << endl;

cout << setprecision(2) << fixed;

cout << "Pay Rate: " << info.gethourlyPay() << endl;

system("pause");

return 0;

}

Tạo thủ tục có tên _Pro04 để trả về số lượng tổng thời gian tham gia dự án Y của nhân viên có mã số X, với X là tham số đầu vào, Y là tham số đầu ra

Answers

Answer:

nigro

Explanation:

Reverse Word Order: Write a program that reverses the order of the words in a given sentence. This program requires reversing the order of the words wherein the first and last words are swapped, followed by swapping the second word with the second to last word, followed by swapping the third word and the third to last words, and so on. Your program will ask the user for an input string and print out the resultant string where the order of the words is reversed. Please see the hints section for more details on an example algorithm. Assume a maximum C-string size of 1000 characters. Make sure your code works for any input number, not just the test cases. Your code will be tested on other test cases not listed here. Do Not Use Predefined Functions from the cstring Library. Please properly comment your code before submission.For this part of the assignment, name your source file as Reverse Word Order_WSUID.cpp. For example, if your user ID is A999B999 name your file as Reverse Word Order_A999B999.cpp. Sample Test Cases: Test Case 1: Input: London bridge has been abducted Output: abducted been has bridge London Test Case 2: Input: Hello World Output: World Hello Test Case 3: Input: Hello World, how are you? Output: you? Are how World, HelloTest Case 4: Input: I like toast Output: toast like l

Answers

Answer:

The program in C++ is as follows:

#include <bits/stdc++.h>

using namespace std;

int main(){

string sentence,word="";

getline (cin, sentence);

vector<string> for_reverse;

for (int i = 0; i < sentence.length(); i++){

 if (sentence[i] == ' ')  {

  for_reverse.push_back(word);

  word = "";  }

 else{    word += sentence[i];}  }

for_reverse.push_back(word);

sentence="";

for (int i = for_reverse.size() - 1; i > 0; i--){

 sentence+=for_reverse[i]+" ";}

sentence+=for_reverse[0];

cout<<sentence<<endl;

return 0;

}

Explanation:

This declares sentence and word as strings; word is then initialized to an empty string

string sentence,word="";

This gets input for sentence

getline (cin, sentence);

This creates a string vector to reverse the input sentence

vector<string> for_reverse;

This iterates through the sentence

for (int i = 0; i < sentence.length(); i++){

This pushes each word of the sentence to the vector when space is encountered

 if (sentence[i] == ' ')  {

  for_reverse.push_back(word);

Initialize word to empty string

  word = "";  }

If the encountered character is not a blank space, the character is added to the current word

 else{    word += sentence[i];}  }

This pushes the last word to the vector

for_reverse.push_back(word);  

This initializes sentence to an empty string

sentence="";

This iterates through the vector

for (int i = for_reverse.size() - 1; i > 0; i--){

This generates the reversed sentence

 sentence+=for_reverse[i]+" ";}

This adds the first word to the end of the sentence

sentence+=for_reverse[0];

Print the sentence

cout<<sentence<<endl;

3. State whether the given statements are true or false. a. The computer is called a data processor because it can store, process, and retrieve data whenever needed. b. Modern processors run so fast in term of megahertz (MHz). c. If millions of calculations are to be performed, a computer will perform every calculation with the same accuracy. d. It is very safe to store data and information on the computer independently. e. If some electrical or electronic damages occur, there are no any chances of data loss or damage f. The output devices of the computer like monitor, printer, speaker, etc. can store meaningful information, g. The input devices can display the output after processing. h. Students can also use computer as their learning tools.​

Answers

Answer:

a,b,c,d,f,g are true only e is false

Develop an algorithm and write a C++ program that finds the number of occurrences of a specified character in the string; make sure you take CString as input and return number of occurrences using call by reference. For example, Write a test program that reads a string and a character and displays the number of occurrences of the character in the string. Here is a sample run of the program:______.

Answers

Answer:

The algorithm is as follows:

1. Input sentence

2. Input character

3. Length = len(sentence)

4. count = 0

5. For i = 0 to Length-1

 5.1 If sentence[i] == character

    5.1.1 count++

6. Print count

7. Stop

The program in C++ is as follows:

#include <iostream>

#include <string.h>

using namespace std;

int main(){

char str[100];   char chr;

cin.getline(str, 100);

cin>>chr;

int count = 0;

for (int i=0;i<strlen(str);i++){

 if (str[i] == chr){

  count++;} }

cout << count;

return 0;}

Explanation:

I will provide explanation for the c++ program. The explanation can also be extended to the algorithm

This declares the string and the character

char str[100];   char chr;

This gets input for the string variable

cin.getline(str, 100);

This gets input for the character variable

cin>>chr;

This initializes count to 0

int count = 0;

This iterates through the characters of the string

for (int i=0;i<strlen(str);i++){

If the current character equals the search character, count is incremented by 1

 if (str[i] == chr){  count++;} }

This prints the count

cout << count;

Alex, a web designer, is assigned the task of creating a mobile device-friendly website for a leading fashion outlet called AllStyles. A desktop version of AllStyles's website already exists. Alex can refer to this desktop version of the website to create the mobile website design The desktop version of the website contains a long list of hyperlinks and this can obstruct the view of the main content when Viewed from a mobile device. Which of the following should Alex use to hide this long list of hypertext links so that it appears only in response to a tap of a major heading in the navigation list?
a. Navigator menus
b. Pulldown menus
c. Pop-up links
d. Header links

Answers

Answer: Pulldown menus

Explanation:

Pulldown menus refer to the graphical control element, that is identical to a list box, which enables user to be bake to select one value from a list.

They're regarded as the menu of options that will appear when an item is selected with a mouse. In this case, the item that the user selected will show at the top of the display screen, while the menu appears will show below it.

Therefore, Alex should use the pulldown menus to hide the long list of hypertext links so that it appears only in response to a tap of a major heading in the navigation list.

Which orientation style has more height than width?

Answers

Answer:

"Portrait orientation" would be the correct answer.

Explanation:

The vertical picture, communication as well as gadget architecture would be considered as Portrait orientation. A webpage featuring portrait orientation seems to be usually larger than large containing lettering, memo abases as well as numerous types of content publications.One such volume fraction also becomes perfect for impressionism depicting an individual from either the top.

Thus the above is the correct answer.

Write a short essay on the importance of information and communication technology (ICT) in the AFN industry. Add suitable examples to substantiate your answer.

Answers

Answer:

computer

Explanation:

is an ICT device that help and makes things or work easy

Use ordinary pipes to implement an inter-process communication scheme for message passing between processes. Assume that there are two directories, d1 and d2, and there are different files in each one of them. Also, each file contains a short-length string of characters. You have to use a parent process that forks two children processes, and have each child process check one of the directories.

Answers

Answer:

Yup

Explanation:

LAB: Winning team (classes)
Complete the Team class implementation. For the class method get_win_percentage(), the formula is:
team_wins / (team_wins + team_losses)
Note: Use floating-point division.
Ex: If the input is:
Ravens
13
3
where Ravens is the team's name, 13 is the number of team wins, and 3 is the number of team losses, the output is:
Congratulations, Team Ravens has a winning average!
If the input is Angels 80 82, the output is:
Team Angels has a losing average.
------------------------------------------------------------------------------------------------------------------------------------
We are given:
class Team:
def __init__(self):
self.team_name = 'none'
self.team_wins = 0
self.team_losses = 0
# TODO: Define get_win_percentage()
if __name__ == "__main__":
team = Team()
team_name = input()
team_wins = int(input())
team_losses = int(input())
team.set_team_name(team_name)
team.set_team_wins(team_wins)
team.set_team_losses(team_losses)
if team.get_win_percentage() >= 0.5:
print('Congratulations, Team', team.team_name,'has a winning average!')
else:
print('Team', team.team_name, 'has a losing average.')
Please help, in Python!

Answers

Answer:

The function is as follows:

def get_win_percentage(self):

       return self.team_wins / (self.team_wins + self.team_losses)

Explanation:

This defines the function

def get_win_percentage(self):

This calculates the win percentage and returns it to main

       return self.team_wins / (self.team_wins + self.team_losses)

See attachment for complete (and modified) program.

Answer: def get_win_percentage(self):

Explanation: got it right on edgen

(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

Answers

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();

                       }

                   }

               }

           }

       }

   }

}

我对汉语的兴趣 làm đoạn văn theo đề trên​

Answers

Answer:

which language is this

Explanation:

Chinese or Korea

A company manufactures televisions. The average weight of the televisions is 5 pounds with a standard deviation of 0.1 pound. Assuming that the weights are normally distributed, what is the weight that represents the 75th percentile?​

Answers

Answer:

5.0674

Explanation:

Given that :

Mean, μ = 5 pounds

Standard deviation, σ = 0.1

Given that weight are normally distributed ;

From the Z table, the Zscore or value for 75th percentile weight is :

P(Z < z) = 0.75

z = 0.674

Using the relation :

Zscore = (x - μ) / σ

x = weight

0.674 = (x - 5) / 0.1

0.674 * 0.1 = x - 5

0.0674 = x - 5

0.0674 + 5 = x - 5 + 5

5.0674 = x

The weight which corresponds to the 75th percentile is 5.0674

Write 'T' for true and 'F' for false statements.

1. The CPU is a piece of external hardware.

2. Keyboards can be connected to a computer using USB port.

3. Monitors are connected via the PS/2 port.

4. A computer can function without a CD drive.

5. Printer is an input device.

6. The read write data in magnetic disks.

7. Pen drives are connected to a computer via the USB interface.

NO LINKS​

Answers

1-F
2-T
3-F
4-F
5-F
6 T
7-T

discuss three ways in which the local government should promote safe and healthy living​

Answers

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.

Telecommunications and software development are examples of information technology careers.
True
False

Answers

Answer:

True

Explanation:

Information technology may be described as the use of systems to aid application designs capable of sending and receiving information and building a communication pathway for individuals and companies. It also involves retrieving, storing large chunks of information and organizational data usually in databases to fast track the seamless functioning of the organization's system. The information technology ecosystem is very broad from those charged with ensuring effective communication such as telecommunications platforms and those who build and develop technologies for effective communication and data storage. Hence, both Telecommunications and software development are examples of information technology careers.

What is scrum of scrum

Answers

Answer: scrum

Explanation:

Answer:

The Scrum of Scrums is a time-boxed session in which a representative from each Team shares high-level updates on their respective team's work and articulates their progress and impediments. Ideally, it should follow the various teams' Daily Stand-ups, so that the latest information is communicated.

hope that helps bby<3

What intangible benefits might an organization obtain from the development of an

information system?​

Answers

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.

Compute the approximate acceleration of gravity for an object above the earth's surface, assigning accel_gravity with the result.
The expression for the acceleration of gravity is: (G*M)/(d2), where G is the gravitational constant 6.673 x 10-11, M is the mass of
the earth 5.98 x 1024 (in kg), and d is the distance in meters from the Earth's center (stored in variable dist_center)
Sample output with input: 6.3782e6 (100 m above the Earth's surface at the equator)
Acceleration of gravity: 9.81

Answers

Answer:

The summary of the given query would be summarized throughout the below segment. The output of the question is attached below.

Explanation:

Given values are:

[tex]G = 6.673e-11[/tex][tex]M = 5.98e24[/tex][tex]accel \ gravity = 0[/tex][tex]dist\ center=float(inp())[/tex]

here,

inp = input

By utilizing the below formula, we get

⇒ [tex]\frac{GM}{d^2}[/tex]

Now,

⇒ [tex]accel \ gravity=\frac{G\times M}{dist \ center**2}[/tex]

⇒ print("Acceleration of gravity: {:.2f}".format(accel_gravity))

Please answer

NO LINKS​

Answers

Answer:

Please find the attached file for the complete solution:

Explanation:

Several families are planning a shared car trip on scenic drives in New Hampshire's White Mountains. To minimize the possibility of any quarrels, they want to assign individuals to cars so that no two members of a family are in the same car. Explain how to formulate this problem as a network flow problem.

Answers

Answer:

Following are the response to the given question:  

Explanation:

Build a spring, sink, vertices, and vertices for each car for a household. Every unit in the stream is a human. Attach the source from each vertical of a family with such a capacity line equivalent to the family size; this sets the number of members in each household. Attach every car vertices to the sink with the edge of the car's passenger belt; this assures the correct number of people for every vehicle. Connecting every vertex in your household to any vertex in your vehicle with a capacity 1 border guarantees that one family member joins a single car. The link between both the acceptable allocation of people to vehicles as well as the maximum flow inside the graph seems clear to notice.

Consider an array inarr containing atleast two non-zero unique positive integers. Identify and print, outnum, the number of unique pairs that can be identified from inarr such that the two integers in the pair when concatenated, results in a palindrome. If no such pairs can be identified, print -1.Input format:Read the array inarr with the elements separated by ,Read the input from the standard input streamOutput format;Print outnum or -1 accordinglyPrint the output to the standard output stream

Answers

Answer:

Program.java  

import java.util.Scanner;  

public class Program {  

   public static boolean isPalindrome(String str){

       int start = 0, end = str.length()-1;

       while (start < end){

           if(str.charAt(start) != str.charAt(end)){

               return false;

           }

           start++;

           end--;

       }

       return true;

   }  

   public static int countPalindromePairs(String[] inarr){

       int count = 0;

       for(int i=0; i<inarr.length; i++){

           for(int j=i+1; j<inarr.length; j++){

               StringBuilder sb = new StringBuilder();

               sb.append(inarr[i]).append(inarr[j]);

               if(isPalindrome(sb.toString())){

                   count++;

               }

           }

       }

       return count == 0 ? -1 : count;

   }

   public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);

       String line = sc.next();

       String[] inarr = line.split(",");

       int count = countPalindromePairs(inarr);

       System.out.println("RESULT: "+count);

   }

}

Explanation:

OUTPUT:

Trình bày phép biến đổi tịnh tiến và quay quanh trục tọa độ? Hãy xác định ma trận chuyển đổi của các phép biến đổi sau :
H = trans(3,7,2). Rot(x,30).Rot(z,45)

Answers

Answer:B

Explanation: she she

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! !!!!!!!!!!!!

Answers

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

what is the difference of expository and reflexive documentary

Answers

The reflexive documentary mode focuses on the relationship between the filmmaker and the audience. While expository documentaries set up a specific point of view or argument about a subject and a narrator often speaks directly to the viewer.

how to add a fixed decimal value to an identifier using Delphi 10 coding?​

Answers

Answer:A declaration defines an identifier (such as the name of a function or variable) that ... This topic introduces the Delphi language character set, and describes the syntax for ... The Delphi language uses the Unicode character encoding for its character set, ... Integer and real constants can be represented in decimal notation as ...

Explanation:

what's the difference between pseudo code and natural language​

Answers

Answer:

The pseudo-code describes steps in an algorithm or another system in plain language. Pseudo-Code is often designed for human reading rather than machine reading with structural conventions of a normal language of programming.

Natural languages consist of phrases, usually declarative phrases, with a sequence of information.

Explanation:

Pseudo-Code is often designed for human reading rather than machine reading with structural conventions of a normal language of programming. It usually omits information that is essential to the understanding of the algorithm by the machine, for example, variable declarations and language code.Easily human, but not machines, use the natural languages (like English).Natural languages also are creative. Poetry, metaphor, and other interpretations are permitted. Programming permits certain style differences, but the significance is not flexible.The aim of using pseudo-code is to make it easier for people to comprehensibly than standard programming language code and to describe the key principles of an algorithm efficiently and environmentally independently. It is usually used for documenting software and other algorithms in textbooks and scientific publications.
Other Questions
write a letter to someone who was bad to you 134567910a.Fill in the blank questions usually requireOne key wordb. A list of vocabulary wordsin the answer.C. Complete sentencesd. None of thesePlease select the best answer from the choices providedU 000 > The peace conditions imposed upon Germany are so hard, so humiliating, that those who had even the tiniest hope for a just peace are bound to be deeply disappointed. Our condemnation of the lust of power and conquest that Germany displayed during the war is strong and unwavering. But a condemnation of wartime actions must not amount to a lasting condemnation of an entire nation.The question is not whether the Germans have been led astray by their leaders, or whether they have been willing accomplices in the misdeeds of those leadersthe question is, whether it is in the interest of mankind to punish the German people as the Entente governments seem to have decided to do.The Entente evidently desires the complete annihilation of Germany. Not only will its whole commercial fleet be confiscated, but its shipbuilding yards will be obliged to work for the foreigner for some time to come. Whole regions of Germany will be entirely deprived of their liberty; they will be under a committee of foreign domination, without adequate representation. The financial burden is so heavy that it is no exaggeration to say that Germany is reduced to economic bondage. The Germans will have to work hard and incessantly for foreign masters, without any chance of personal gain, or any prospect of regaining liberty or economic independence.This peace offered to Germany is a mockery of President Wilsons principles. Trusting in these, Germany surrendered and accepted peace. That confidence has been betrayed in such a manner that all Germans must now feel that they wish to shake off the heavy yoke imposed on them by the cajoling Entente. And we fear very much that they will soon find the opportunity to do so. Chained and enslaved, Germany will always remain a menace to Europe.Algemeen Handelsblad, Dutch liberal newspaper, editorial on the Treaty of Versailles, June 1919The mention of President Wilsons principles is most directly significant to understanding the editorials point of view about the Treaty of Versailles because of the United States presidents commitment toestablish an international organization to prevent future conflictsAnswer A: establish an international organization to prevent future conflictsAwork to create nation-states for ethnic minorities that had been under imperial controlAnswer B: work to create nation-states for ethnic minorities that had been under imperial controlBbroker a peace agreement on liberal principles that would not be motivated by revengeAnswer C: broker a peace agreement on liberal principles that would not be motivated by revengeCresist the spread of Bolshevism following the Russian Revolution The Thirty Years War in Central Europe began whenthe Anglican Church was established in Germany and was met with resistance.Lutheran princes challenged the Holy Roman Emperor, who was Catholic.Lutheran princes battled Huguenot princes for control of German states.Calvinists went to Germany to spread their beliefs and establish strict laws. 4) Last week Kathryn ran 8.6 miles morethan Jaidee. Kathryn ran 22.3 miles. Howmany miles did Jaidee run? please i have 15 minutes Essay: (210-250 words)The heat in the cell was unbearable. I tried not to yawn as I struggled to stay awake, notdaring to lose myself to sleep....Write an essay starting with the above phrase. Question 11 of 40Factor this polynomial completely.x2 - 6x + 9A. (x+3)(x+3)B. Does not factorC. (x-3)(x - 3)D. (x+3)(x-3) At 40km up in the atmosphere the pressure is 3.8 kPa. I release a balloon with a volume of 30.0liters from sea level. The balloon ascends up into to atmosphere 40 km. What will be the newvolume of the balloon, assuming no change in temperature?Answer in liters Find all solutions to the equation in the interval [0, 2pie]. Enter the solutions in increasing order. cos 2x = sin x Solve for x round to the nearest tenth if necessary Find an expression which represents the sum of (8x-7)(8x7) and (10x+3)(10x+3) in simplest terms.enyone else tired of getting dleted also anyone wants to talk? On December 31, the trial balance indicates that the supplies account has a balance, prior to the adjusting entry, of $269. A physical count of the supplies inventory shows that $102 of supplies remain. Analyze this adjustment for supplies using T accounts, and then formally enter this adjustment in the general journal. (Find mIGH) mIGH= Lin Corporation has a single product whose selling price is $134 per unit and whose variable expense is $67 per unit. The companys monthly fixed expense is $31,750. Required: 1. Calculate the unit sales needed to attain a target profit of $8,450. (Do not round intermediate calculations.) 2. Calculate the dollar sales needed to attain a target profit of $9,700. ????????????????????????????????????????????????????? A 1,500-kg truck has a net force of 4,200 N acting on it . What is the trucks' acceleration In a simple way to create suspense lee child develops the central idea that writers can develop suspense by real waking answers When using the process of evaporation to separate a mixture what is left behind to an evaporating dishA. The mixture does not separate in the entire mixture remains in the dishB. The liquid evaporates in the solid is left in the dishC. The mixture does not separate in the entire mixture evaporatesD. None of these A shoe repairman is working with his assistant, who takes 1.5 times as long to repair a pair of shoes.Together they can fix 10 pairs of shoes in six hours. How long does it take the repairman to fix one pairof shoes by himself?